Files
46
Total Lines
29173
Coverage
52.0%
286 / 541 lines
Actions
50.0%
lib/commerce-payments/src/AuthCaptureEscrow.sol
Lines covered: 54 / 106 (50.0%)
| 1 | // SPDX-License-Identifier: MIT |
| 2 | // Original: Base Commerce Payments (MIT License) |
| 3 | // Modifications: Copyright 2025-2026 Ali Abdoli and Vrajang Parikh (BUSL-1.1) |
| 4 | pragma solidity ^0.8.28; |
| 5 | |
| 6 | import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; |
| 7 | import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; |
| 8 | import {ReentrancyGuardTransient} from "solady/utils/ReentrancyGuardTransient.sol"; |
| 9 | import {LibClone} from "solady/utils/LibClone.sol"; |
| 10 | |
| 11 | import {TokenStore} from "./TokenStore.sol"; |
| 12 | import {TokenCollector} from "./collectors/TokenCollector.sol"; |
| 13 | |
| 14 | /// @title AuthCaptureEscrow |
| 15 | /// |
| 16 | /// @notice Facilitate payments through an escrow. |
| 17 | /// |
| 18 | /// @dev By escrowing payment, this contract can mimic the 2-step payment pattern of "authorization" and "capture". |
| 19 | /// @dev Authorization is defined as placing a hold on a payer's funds temporarily. |
| 20 | /// @dev Capture is defined as distributing payment to the end recipient. |
| 21 | /// @dev An Operator plays the role of facilitating state transitions associated with a payment, constrained by cryptographic authorization |
| 22 | /// from a payer and confirmation signals from the merchant. |
| 23 | /// |
| 24 | /// @author Coinbase (https://github.com/base/commerce-payments) |
| 25 | contract AuthCaptureEscrow is ReentrancyGuardTransient { |
| 26 | using SafeERC20 for IERC20; |
| 27 | |
| 28 | /// @notice Payment info, contains all information required to authorize and capture a unique payment |
| 29 | struct PaymentInfo { |
| 30 | /// @dev Entity responsible for driving payment flow |
| 31 | address operator; |
| 32 | /// @dev The payer's address authorizing the payment |
| 33 | address payer; |
| 34 | /// @dev Address that receives the payment (minus fees) |
| 35 | address receiver; |
| 36 | /// @dev The token contract address |
| 37 | address token; |
| 38 | /// @dev The amount of tokens that can be authorized |
| 39 | uint120 maxAmount; |
| 40 | /// @dev Timestamp when the payer's pre-approval can no longer authorize payment |
| 41 | uint48 preApprovalExpiry; |
| 42 | /// @dev Timestamp when an authorization can no longer be captured and the payer can reclaim from escrow |
| 43 | uint48 authorizationExpiry; |
| 44 | /// @dev Timestamp when a successful payment can no longer be refunded |
| 45 | uint48 refundExpiry; |
| 46 | /// @dev Minimum fee percentage in basis points |
| 47 | uint16 minFeeBps; |
| 48 | /// @dev Maximum fee percentage in basis points |
| 49 | uint16 maxFeeBps; |
| 50 | /// @dev Address that receives the fee portion of payments, if 0 then operator can set at capture |
| 51 | address feeReceiver; |
| 52 | /// @dev A source of entropy to ensure unique hashes across different payments |
| 53 | uint256 salt; |
| 54 | } |
| 55 | |
| 56 | /// @notice State for tracking payments through lifecycle |
| 57 | struct PaymentState { |
| 58 | /// @dev True if payment has been authorized or charged |
| 59 | bool hasCollectedPayment; |
| 60 | /// @dev Amount of tokens currently on hold in escrow that can be captured |
| 61 | uint120 capturableAmount; |
| 62 | /// @dev Amount of tokens previously captured that can be refunded |
| 63 | uint120 refundableAmount; |
| 64 | } |
| 65 | |
| 66 | /// @notice Typehash used for hashing PaymentInfo structs |
| 67 | bytes32 public constant PAYMENT_INFO_TYPEHASH = keccak256( |
| 68 | "PaymentInfo(address operator,address payer,address receiver,address token,uint120 maxAmount,uint48 preApprovalExpiry,uint48 authorizationExpiry,uint48 refundExpiry,uint16 minFeeBps,uint16 maxFeeBps,address feeReceiver,uint256 salt)" |
| 69 | ); |
| 70 | |
| 71 | uint16 internal constant _MAX_FEE_BPS = 10_000; |
| 72 | |
| 73 | /// @notice Implementation contract for operator token stores |
| 74 | address public immutable tokenStoreImplementation; |
| 75 | |
| 76 | /// @notice State per unique payment |
| 77 | mapping(bytes32 paymentInfoHash => PaymentState state) public paymentState; |
| 78 | |
| 79 | /// @notice Emitted when a payment is charged and immediately captured |
| 80 | event PaymentCharged( |
| 81 | bytes32 indexed paymentInfoHash, |
| 82 | PaymentInfo paymentInfo, |
| 83 | uint256 amount, |
| 84 | address tokenCollector, |
| 85 | uint16 feeBps, |
| 86 | address feeReceiver |
| 87 | ); |
| 88 | |
| 89 | /// @notice Emitted when authorized (escrowed) amount is increased |
| 90 | event PaymentAuthorized( |
| 91 | bytes32 indexed paymentInfoHash, PaymentInfo paymentInfo, uint256 amount, address tokenCollector |
| 92 | ); |
| 93 | |
| 94 | /// @notice Emitted when payment is captured from escrow |
| 95 | event PaymentCaptured(bytes32 indexed paymentInfoHash, uint256 amount, uint16 feeBps, address feeReceiver); |
| 96 | |
| 97 | /// @notice Emitted when an authorized payment is voided, returning any escrowed funds to the payer |
| 98 | event PaymentVoided(bytes32 indexed paymentInfoHash, uint256 amount); |
| 99 | |
| 100 | /// @notice Emitted when part of an authorized payment is voided, returning partial escrowed funds to the payer |
| 101 | /// @dev Added by BackTrackCo for partial pre-capture refund support |
| 102 | event PaymentPartiallyVoided(bytes32 indexed paymentInfoHash, uint256 amount, uint256 remainingCapturable); |
| 103 | |
| 104 | /// @notice Emitted when an authorized payment is reclaimed, returning any escrowed funds to the payer |
| 105 | event PaymentReclaimed(bytes32 indexed paymentInfoHash, uint256 amount); |
| 106 | |
| 107 | /// @notice Emitted when a captured payment is refunded |
| 108 | event PaymentRefunded(bytes32 indexed paymentInfoHash, uint256 amount, address tokenCollector); |
| 109 | |
| 110 | /// @notice Event emitted when new token store is created |
| 111 | event TokenStoreCreated(address indexed operator, address tokenStore); |
| 112 | |
| 113 | /// @notice Sender for a function call does not follow access control requirements |
| 114 | error InvalidSender(address sender, address expected); |
| 115 | |
| 116 | /// @notice Amount is zero |
| 117 | error ZeroAmount(); |
| 118 | |
| 119 | /// @notice Amount overflows allowed storage size of uint120 |
| 120 | error AmountOverflow(uint256 amount, uint256 limit); |
| 121 | |
| 122 | /// @notice Requested authorization amount exceeds `PaymentInfo.maxAmount` |
| 123 | error ExceedsMaxAmount(uint256 amount, uint256 maxAmount); |
| 124 | |
| 125 | /// @notice Authorization attempted after pre-approval expiry |
| 126 | error AfterPreApprovalExpiry(uint48 timestamp, uint48 expiry); |
| 127 | |
| 128 | /// @notice Expiry timestamps violate preApproval <= authorization <= refund |
| 129 | error InvalidExpiries(uint48 preApproval, uint48 authorization, uint48 refund); |
| 130 | |
| 131 | /// @notice Fee bips overflows 10_000 maximum |
| 132 | error FeeBpsOverflow(uint16 feeBps); |
| 133 | |
| 134 | /// @notice Fee bps range invalid due to min > max |
| 135 | error InvalidFeeBpsRange(uint16 minFeeBps, uint16 maxFeeBps); |
| 136 | |
| 137 | /// @notice Fee bps outside of allowed range |
| 138 | error FeeBpsOutOfRange(uint16 feeBps, uint16 minFeeBps, uint16 maxFeeBps); |
| 139 | |
| 140 | /// @notice Fee receiver is zero address with a non-zero fee |
| 141 | error ZeroFeeReceiver(); |
| 142 | |
| 143 | /// @notice Fee recipient cannot be changed |
| 144 | error InvalidFeeReceiver(address attempted, address expected); |
| 145 | |
| 146 | /// @notice Token collector is not valid for the operation |
| 147 | error InvalidCollectorForOperation(); |
| 148 | |
| 149 | /// @notice Token pull failed |
| 150 | error TokenCollectionFailed(); |
| 151 | |
| 152 | /// @notice Charge or authorize attempted on a payment has already been collected |
| 153 | error PaymentAlreadyCollected(bytes32 paymentInfoHash); |
| 154 | |
| 155 | /// @notice Capture attempted at or after authorization expiry |
| 156 | error AfterAuthorizationExpiry(uint48 timestamp, uint48 expiry); |
| 157 | |
| 158 | /// @notice Capture attempted with insufficient authorization amount |
| 159 | error InsufficientAuthorization(bytes32 paymentInfoHash, uint256 authorizedAmount, uint256 requestedAmount); |
| 160 | |
| 161 | /// @notice Void or reclaim attempted with zero authorization amount |
| 162 | error ZeroAuthorization(bytes32 paymentInfoHash); |
| 163 | |
| 164 | /// @notice Partial void amount exceeds capturable amount |
| 165 | /// @dev Added by BackTrackCo for partial pre-capture refund support |
| 166 | error PartialVoidExceedsCapturable(uint256 requested, uint256 available); |
| 167 | |
| 168 | /// @notice Reclaim attempted before authorization expiry |
| 169 | error BeforeAuthorizationExpiry(uint48 timestamp, uint48 expiry); |
| 170 | |
| 171 | /// @notice Refund attempted at or after refund expiry |
| 172 | error AfterRefundExpiry(uint48 timestamp, uint48 expiry); |
| 173 | |
| 174 | /// @notice Refund attempted with amount exceeding previous non-refunded captures |
| 175 | error RefundExceedsCapture(uint256 refund, uint256 captured); |
| 176 | |
| 177 | /// @notice Check call sender is specified address |
| 178 | /// |
| 179 | /// @param sender Address to enforce is the call sender |
| 180 | modifier onlySender(address sender) { |
| 181 | if (msg.sender != sender) revert InvalidSender(msg.sender, sender); |
| 182 | _; |
| 183 | } |
| 184 | |
| 185 | /// @notice Ensures amount is non-zero and does not overflow storage |
| 186 | /// |
| 187 | /// @param amount Quantity of tokens being requested for a given operation |
| 188 | modifier validAmount(uint256 amount) { |
| 189 | if (amount == 0) revert ZeroAmount(); |
| 190 | if (amount > type(uint120).max) revert AmountOverflow(amount, type(uint120).max); |
| 191 | _; |
| 192 | } |
| 193 | |
| 194 | /// @notice Constructor that auto-deploys TokenStore implementation to clone |
| 195 | constructor() { |
| 196 | tokenStoreImplementation = address(new TokenStore(address(this))); |
| 197 | } |
| 198 | |
| 199 | /// @notice Transfers funds from payer to receiver in one step |
| 200 | /// |
| 201 | /// @dev If amount is less than the authorized amount, only amount is taken from payer |
| 202 | /// @dev Reverts if the authorization has been voided or expired |
| 203 | /// |
| 204 | /// @param paymentInfo PaymentInfo struct |
| 205 | /// @param amount Amount to charge and capture |
| 206 | /// @param tokenCollector Address of the token collector |
| 207 | /// @param collectorData Data to pass to the token collector |
| 208 | /// @param feeBps Fee percentage to apply (must be within min/max range) |
| 209 | /// @param feeReceiver Address to receive fees (should match the paymentInfo.feeReceiver unless that is 0 in which case it can be any address) |
| 210 | function charge( |
| 211 | PaymentInfo calldata paymentInfo, |
| 212 | uint256 amount, |
| 213 | address tokenCollector, |
| 214 | bytes calldata collectorData, |
| 215 | uint16 feeBps, |
| 216 | address feeReceiver |
| 217 | ) external nonReentrant onlySender(paymentInfo.operator) validAmount(amount) { |
| 218 | // Check payment info valid |
| 219 | _validatePayment(paymentInfo, amount); |
| 220 | |
| 221 | // Check fee parameters valid |
| 222 | _validateFee(paymentInfo, feeBps, feeReceiver); |
| 223 | |
| 224 | // Check payment not already collected |
| 225 | bytes32 paymentInfoHash = getHash(paymentInfo); |
| 226 | if (paymentState[paymentInfoHash].hasCollectedPayment) revert PaymentAlreadyCollected(paymentInfoHash); |
| 227 | |
| 228 | // Set payment state with refundable amount |
| 229 | paymentState[paymentInfoHash] = |
| 230 | PaymentState({hasCollectedPayment: true, capturableAmount: 0, refundableAmount: uint120(amount)}); |
| 231 | emit PaymentCharged(paymentInfoHash, paymentInfo, amount, tokenCollector, feeBps, feeReceiver); |
| 232 | |
| 233 | // Transfer tokens into escrow |
| 234 | _collectTokens(paymentInfo, amount, tokenCollector, collectorData, TokenCollector.CollectorType.Payment); |
| 235 | |
| 236 | // Transfer tokens to receiver and fee receiver |
| 237 | _distributeTokens(paymentInfo.token, paymentInfo.receiver, amount, feeBps, feeReceiver); |
| 238 | } |
| 239 | |
| 240 | /// @notice Transfers funds from payer to escrow |
| 241 | /// |
| 242 | /// @param paymentInfo PaymentInfo struct |
| 243 | /// @param amount Amount to authorize |
| 244 | /// @param tokenCollector Address of the token collector |
| 245 | /// @param collectorData Data to pass to the token collector |
| 246 | function authorize( |
| 247 | PaymentInfo calldata paymentInfo, |
| 248 | uint256 amount, |
| 249 | address tokenCollector, |
| 250 | bytes calldata collectorData |
| 251 | ) external nonReentrant onlySender(paymentInfo.operator) validAmount(amount) { |
| 252 | // Check payment info valid |
| 253 | _validatePayment(paymentInfo, amount); |
| 254 | |
| 255 | // Check payment not already collected |
| 256 | bytes32 paymentInfoHash = getHash(paymentInfo); |
| 257 | if (paymentState[paymentInfoHash].hasCollectedPayment) revert PaymentAlreadyCollected(paymentInfoHash); |
| 258 | |
| 259 | // Set payment state with capturable amount |
| 260 | paymentState[paymentInfoHash] = |
| 261 | PaymentState({hasCollectedPayment: true, capturableAmount: uint120(amount), refundableAmount: 0}); |
| 262 | emit PaymentAuthorized(paymentInfoHash, paymentInfo, amount, tokenCollector); |
| 263 | |
| 264 | // Transfer tokens into escrow |
| 265 | _collectTokens(paymentInfo, amount, tokenCollector, collectorData, TokenCollector.CollectorType.Payment); |
| 266 | } |
| 267 | |
| 268 | /// @notice Transfer previously-escrowed funds to receiver |
| 269 | /// |
| 270 | /// @dev Can be called multiple times up to cumulative authorized amount |
| 271 | /// @dev Can only be called by the operator |
| 272 | /// |
| 273 | /// @param paymentInfo PaymentInfo struct |
| 274 | /// @param amount Amount to capture |
| 275 | /// @param feeBps Fee percentage to apply (must be within min/max range) |
| 276 | /// @param feeReceiver Address to receive fees (should match the paymentInfo.feeReceiver unless that is 0 in which case it can be any address) |
| 277 | function capture(PaymentInfo calldata paymentInfo, uint256 amount, uint16 feeBps, address feeReceiver) |
| 278 | external |
| 279 | nonReentrant |
| 280 | onlySender(paymentInfo.operator) |
| 281 | validAmount(amount) |
| 282 | { |
| 283 | // Check fee parameters valid |
| 284 | _validateFee(paymentInfo, feeBps, feeReceiver); |
| 285 | |
| 286 | // Check before authorization expiry |
| 287 | if (block.timestamp >= paymentInfo.authorizationExpiry) { |
| 288 | revert AfterAuthorizationExpiry(uint48(block.timestamp), paymentInfo.authorizationExpiry); |
| 289 | } |
| 290 | |
| 291 | // Check sufficient escrow to capture |
| 292 | bytes32 paymentInfoHash = getHash(paymentInfo); |
| 293 | PaymentState memory state = paymentState[paymentInfoHash]; |
| 294 | if (state.capturableAmount < amount) { |
| 295 | revert InsufficientAuthorization(paymentInfoHash, state.capturableAmount, amount); |
| 296 | } |
| 297 | |
| 298 | // Update payment state, converting capturable amount to refundable amount |
| 299 | state.capturableAmount -= uint120(amount); |
| 300 | state.refundableAmount += uint120(amount); |
| 301 | paymentState[paymentInfoHash] = state; |
| 302 | emit PaymentCaptured(paymentInfoHash, amount, feeBps, feeReceiver); |
| 303 | |
| 304 | // Transfer tokens to receiver and fee receiver |
| 305 | _distributeTokens(paymentInfo.token, paymentInfo.receiver, amount, feeBps, feeReceiver); |
| 306 | } |
| 307 | |
| 308 | /// @notice Permanently voids a payment authorization |
| 309 | /// |
| 310 | /// @dev Returns any escrowed funds to payer |
| 311 | /// @dev Can only be called by the operator |
| 312 | /// |
| 313 | /// @param paymentInfo PaymentInfo struct |
| 314 | function void(PaymentInfo calldata paymentInfo) external nonReentrant onlySender(paymentInfo.operator) { |
| 315 | // Check authorization non-zero |
| 316 | bytes32 paymentInfoHash = getHash(paymentInfo); |
| 317 | uint256 authorizedAmount = paymentState[paymentInfoHash].capturableAmount; |
| 318 | if (authorizedAmount == 0) revert ZeroAuthorization(paymentInfoHash); |
| 319 | |
| 320 | // Clear capturable amount state |
| 321 | paymentState[paymentInfoHash].capturableAmount = 0; |
| 322 | emit PaymentVoided(paymentInfoHash, authorizedAmount); |
| 323 | |
| 324 | // Transfer tokens to payer from token store |
| 325 | _sendTokens(paymentInfo.operator, paymentInfo.token, paymentInfo.payer, authorizedAmount); |
| 326 | } |
| 327 | |
| 328 | /// @notice Partially voids a payment authorization, returning a portion of escrowed funds to payer |
| 329 | /// |
| 330 | /// @dev Unlike void() which returns all escrowed funds, this allows partial refunds before capture |
| 331 | /// @dev Can only be called by the operator |
| 332 | /// @dev Added by BackTrackCo for partial pre-capture refund support |
| 333 | /// |
| 334 | /// @param paymentInfo PaymentInfo struct |
| 335 | /// @param amount Amount to return to payer (must be <= capturableAmount) |
| 336 | function partialVoid(PaymentInfo calldata paymentInfo, uint120 amount) |
| 337 | external |
| 338 | nonReentrant |
| 339 | onlySender(paymentInfo.operator) |
| 340 | validAmount(amount) |
| 341 | { |
| 342 | bytes32 paymentInfoHash = getHash(paymentInfo); |
| 343 | uint120 capturableAmount = paymentState[paymentInfoHash].capturableAmount; |
| 344 | |
| 345 | // Check requested amount does not exceed available |
| 346 | if (amount > capturableAmount) revert PartialVoidExceedsCapturable(amount, capturableAmount); |
| 347 | |
| 348 | // Reduce capturable amount |
| 349 | paymentState[paymentInfoHash].capturableAmount = capturableAmount - amount; |
| 350 | emit PaymentPartiallyVoided(paymentInfoHash, amount, capturableAmount - amount); |
| 351 | |
| 352 | // Transfer tokens to payer from token store |
| 353 | _sendTokens(paymentInfo.operator, paymentInfo.token, paymentInfo.payer, amount); |
| 354 | } |
| 355 | |
| 356 | /// @notice Returns any escrowed funds to payer |
| 357 | /// |
| 358 | /// @dev Can only be called by the payer and only after the authorization expiry |
| 359 | /// |
| 360 | /// @param paymentInfo PaymentInfo struct |
| 361 | function reclaim(PaymentInfo calldata paymentInfo) external nonReentrant onlySender(paymentInfo.payer) { |
| 362 | // Check not before authorization expiry |
| 363 | if (block.timestamp < paymentInfo.authorizationExpiry) { |
| 364 | revert BeforeAuthorizationExpiry(uint48(block.timestamp), paymentInfo.authorizationExpiry); |
| 365 | } |
| 366 | |
| 367 | // Check authorization non-zero |
| 368 | bytes32 paymentInfoHash = getHash(paymentInfo); |
| 369 | uint256 authorizedAmount = paymentState[paymentInfoHash].capturableAmount; |
| 370 | if (authorizedAmount == 0) revert ZeroAuthorization(paymentInfoHash); |
| 371 | |
| 372 | // Clear capturable amount state |
| 373 | paymentState[paymentInfoHash].capturableAmount = 0; |
| 374 | emit PaymentReclaimed(paymentInfoHash, authorizedAmount); |
| 375 | |
| 376 | // Transfer tokens to payer from token store |
| 377 | _sendTokens(paymentInfo.operator, paymentInfo.token, paymentInfo.payer, authorizedAmount); |
| 378 | } |
| 379 | |
| 380 | /// @notice Return previously-captured tokens to payer |
| 381 | /// |
| 382 | /// @dev Can be called by operator |
| 383 | /// @dev Funds are transferred from the caller or from the escrow if token collector retrieves external liquidity |
| 384 | /// |
| 385 | /// @param paymentInfo PaymentInfo struct |
| 386 | /// @param amount Amount to refund |
| 387 | /// @param tokenCollector Address of the token collector |
| 388 | /// @param collectorData Data to pass to the token collector |
| 389 | function refund( |
| 390 | PaymentInfo calldata paymentInfo, |
| 391 | uint256 amount, |
| 392 | address tokenCollector, |
| 393 | bytes calldata collectorData |
| 394 | ) external nonReentrant onlySender(paymentInfo.operator) validAmount(amount) { |
| 395 | // Check refund has not expired |
| 396 | if (block.timestamp >= paymentInfo.refundExpiry) { |
| 397 | revert AfterRefundExpiry(uint48(block.timestamp), paymentInfo.refundExpiry); |
| 398 | } |
| 399 | |
| 400 | // Limit refund amount to previously captured |
| 401 | bytes32 paymentInfoHash = getHash(paymentInfo); |
| 402 | uint120 captured = paymentState[paymentInfoHash].refundableAmount; |
| 403 | if (captured < amount) revert RefundExceedsCapture(amount, captured); |
| 404 | |
| 405 | // Update refundable amount |
| 406 | paymentState[paymentInfoHash].refundableAmount = captured - uint120(amount); |
| 407 | emit PaymentRefunded(paymentInfoHash, amount, tokenCollector); |
| 408 | |
| 409 | // Transfer tokens into escrow and forward to payer |
| 410 | _collectTokens(paymentInfo, amount, tokenCollector, collectorData, TokenCollector.CollectorType.Refund); |
| 411 | _sendTokens(paymentInfo.operator, paymentInfo.token, paymentInfo.payer, amount); |
| 412 | } |
| 413 | |
| 414 | /// @notice Get hash of PaymentInfo struct |
| 415 | /// |
| 416 | /// @dev Includes chainId and verifyingContract in hash for cross-chain and cross-contract uniqueness |
| 417 | /// |
| 418 | /// @param paymentInfo PaymentInfo struct |
| 419 | /// |
| 420 | /// @return Hash of payment info for the current chain and contract address |
| 421 | function getHash(PaymentInfo calldata paymentInfo) public view returns (bytes32) { |
| 422 | bytes32 paymentInfoHash = keccak256(abi.encode(PAYMENT_INFO_TYPEHASH, paymentInfo)); |
| 423 | return keccak256(abi.encode(block.chainid, address(this), paymentInfoHash)); |
| 424 | } |
| 425 | |
| 426 | /// @notice Get the token store address for an operator |
| 427 | /// |
| 428 | /// @param operator The operator to get the token store for |
| 429 | /// |
| 430 | /// @return The operator's token store address |
| 431 | function getTokenStore(address operator) public view returns (address) { |
| 432 | return LibClone.predictDeterministicAddress({ |
| 433 | implementation: tokenStoreImplementation, |
| 434 | salt: bytes32(bytes20(operator)), |
| 435 | deployer: address(this) |
| 436 | }); |
| 437 | } |
| 438 | |
| 439 | /// @notice Transfer tokens into this contract |
| 440 | /// |
| 441 | /// @param paymentInfo PaymentInfo struct |
| 442 | /// @param amount Amount of tokens to collect |
| 443 | /// @param tokenCollector Address of the token collector |
| 444 | /// @param collectorData Data to pass to the token collector |
| 445 | /// @param collectorType Type of collector to enforce (payment or refund) |
| 446 | function _collectTokens( |
| 447 | PaymentInfo calldata paymentInfo, |
| 448 | uint256 amount, |
| 449 | address tokenCollector, |
| 450 | bytes calldata collectorData, |
| 451 | TokenCollector.CollectorType collectorType |
| 452 | ) internal { |
| 453 | // Check token collector matches required type |
| 454 | if (TokenCollector(tokenCollector).collectorType() != collectorType) revert InvalidCollectorForOperation(); |
| 455 | |
| 456 | // Measure balance change of token store to enforce as equal to expected amount |
| 457 | address token = paymentInfo.token; |
| 458 | address tokenStore = getTokenStore(paymentInfo.operator); |
| 459 | uint256 tokenStoreBalanceBefore = IERC20(token).balanceOf(tokenStore); |
| 460 | TokenCollector(tokenCollector).collectTokens(paymentInfo, tokenStore, amount, collectorData); |
| 461 | uint256 tokenStoreBalanceAfter = IERC20(token).balanceOf(tokenStore); |
| 462 | if (tokenStoreBalanceAfter != tokenStoreBalanceBefore + amount) revert TokenCollectionFailed(); |
| 463 | } |
| 464 | |
| 465 | /// @notice Send tokens from an operator's token store |
| 466 | /// |
| 467 | /// @param operator The operator whose token store to use |
| 468 | /// @param token The token to send |
| 469 | /// @param recipient Address to receive the tokens |
| 470 | /// @param amount Amount of tokens to send |
| 471 | function _sendTokens(address operator, address token, address recipient, uint256 amount) internal { |
| 472 | // Attempt to transfer tokens |
| 473 | address tokenStore = getTokenStore(operator); |
| 474 | bytes memory callData = abi.encodeWithSelector(TokenStore.sendTokens.selector, token, recipient, amount); |
| 475 | (bool success, bytes memory returnData) = tokenStore.call(callData); |
| 476 | if (success && returnData.length == 32 && abi.decode(returnData, (bool))) { |
| 477 | return; |
| 478 | } else if (tokenStore.code.length == 0) { |
| 479 | // Call failed from undeployed TokenStore, deploy and try again |
| 480 | tokenStore = LibClone.cloneDeterministic({ |
| 481 | implementation: tokenStoreImplementation, |
| 482 | salt: bytes32(bytes20(operator)) |
| 483 | }); |
| 484 | emit TokenStoreCreated(operator, tokenStore); |
| 485 | TokenStore(tokenStore).sendTokens(token, recipient, amount); |
| 486 | } else { |
| 487 | // Call failed from revert, bubble up data |
| 488 | assembly ("memory-safe") { |
| 489 | let returnDataSize := mload(returnData) |
| 490 | revert(add(32, returnData), returnDataSize) |
| 491 | } |
| 492 | } |
| 493 | } |
| 494 | |
| 495 | /// @notice Sends tokens to receiver and/or feeReceiver |
| 496 | /// |
| 497 | /// @param token Token to transfer |
| 498 | /// @param receiver Address to receive payment |
| 499 | /// @param amount Total amount to split between payment and fees |
| 500 | /// @param feeBps Fee percentage in basis points |
| 501 | /// @param feeReceiver Address to receive fees |
| 502 | function _distributeTokens(address token, address receiver, uint256 amount, uint16 feeBps, address feeReceiver) |
| 503 | internal |
| 504 | { |
| 505 | uint256 feeAmount = amount * feeBps / _MAX_FEE_BPS; |
| 506 | |
| 507 | // Send fee portion if non-zero |
| 508 | if (feeAmount > 0) _sendTokens(msg.sender, token, feeReceiver, feeAmount); |
| 509 | |
| 510 | // Send remaining amount to receiver |
| 511 | if (amount > feeAmount) _sendTokens(msg.sender, token, receiver, amount - feeAmount); |
| 512 | } |
| 513 | |
| 514 | /// @notice Validates required properties of a payment |
| 515 | /// |
| 516 | /// @param paymentInfo PaymentInfo struct |
| 517 | /// @param amount Token amount to validate against |
| 518 | function _validatePayment(PaymentInfo calldata paymentInfo, uint256 amount) internal view { |
| 519 | uint120 maxAmount = paymentInfo.maxAmount; |
| 520 | uint48 preApprovalExp = paymentInfo.preApprovalExpiry; |
| 521 | uint48 authorizationExp = paymentInfo.authorizationExpiry; |
| 522 | uint48 refundExp = paymentInfo.refundExpiry; |
| 523 | uint16 minFeeBps = paymentInfo.minFeeBps; |
| 524 | uint16 maxFeeBps = paymentInfo.maxFeeBps; |
| 525 | uint48 currentTime = uint48(block.timestamp); |
| 526 | |
| 527 | // Check amount does not exceed maximum |
| 528 | if (amount > maxAmount) revert ExceedsMaxAmount(amount, maxAmount); |
| 529 | |
| 530 | // Timestamp comparisons cannot overflow uint48 |
| 531 | if (currentTime >= preApprovalExp) revert AfterPreApprovalExpiry(currentTime, preApprovalExp); |
| 532 | |
| 533 | // Check expiry timestamps properly ordered |
| 534 | if (preApprovalExp > authorizationExp || authorizationExp > refundExp) { |
| 535 | revert InvalidExpiries(preApprovalExp, authorizationExp, refundExp); |
| 536 | } |
| 537 | |
| 538 | // Check fee bps do not exceed maximum value |
| 539 | if (maxFeeBps > _MAX_FEE_BPS) revert FeeBpsOverflow(maxFeeBps); |
| 540 | |
| 541 | // Check min fee bps does not exceed max fee |
| 542 | if (minFeeBps > maxFeeBps) revert InvalidFeeBpsRange(minFeeBps, maxFeeBps); |
| 543 | } |
| 544 | |
| 545 | /// @notice Validates attempted fee adheres to constraints set by payment info |
| 546 | /// |
| 547 | /// @param paymentInfo PaymentInfo struct |
| 548 | /// @param feeBps Fee percentage in basis points |
| 549 | /// @param feeReceiver Address to receive fees |
| 550 | function _validateFee(PaymentInfo calldata paymentInfo, uint16 feeBps, address feeReceiver) internal pure { |
| 551 | uint16 minFeeBps = paymentInfo.minFeeBps; |
| 552 | uint16 maxFeeBps = paymentInfo.maxFeeBps; |
| 553 | address configuredFeeReceiver = paymentInfo.feeReceiver; |
| 554 | |
| 555 | // Check fee bps within [min, max] |
| 556 | if (feeBps < minFeeBps || feeBps > maxFeeBps) revert FeeBpsOutOfRange(feeBps, minFeeBps, maxFeeBps); |
| 557 | |
| 558 | // Check fee recipient only zero address if zero fee bps |
| 559 | if (feeReceiver == address(0) && feeBps > 0) revert ZeroFeeReceiver(); |
| 560 | |
| 561 | // Check fee receiver matches payment info if non-zero |
| 562 | if (configuredFeeReceiver != address(0) && configuredFeeReceiver != feeReceiver) { |
| 563 | revert InvalidFeeReceiver(feeReceiver, configuredFeeReceiver); |
| 564 | } |
| 565 | } |
| 566 | |
| 567 | /// @dev Override to use transient reentrancy guard on all chains |
| 568 | function _useTransientReentrancyGuardOnlyOnMainnet() internal view virtual override returns (bool) { |
| 569 | return false; |
| 570 | } |
| 571 | } |
| 572 |
50.0%
lib/commerce-payments/src/TokenStore.sol
Lines covered: 2 / 4 (50.0%)
| 1 | // SPDX-License-Identifier: MIT |
| 2 | pragma solidity ^0.8.28; |
| 3 | |
| 4 | import {SafeERC20, IERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; |
| 5 | |
| 6 | /// @title TokenStore |
| 7 | /// |
| 8 | /// @notice Holds funds for payments associated with a single operator |
| 9 | /// |
| 10 | /// @dev Deployed on demand by AuthCaptureEscrow via CREATE2 clones |
| 11 | /// |
| 12 | /// @author Coinbase (https://github.com/base/commerce-payments) |
| 13 | contract TokenStore { |
| 14 | /// @notice AuthCaptureEscrow singleton that created this token store |
| 15 | address public immutable authCaptureEscrow; |
| 16 | |
| 17 | /// @notice Call sender is not AuthCaptureEscrow |
| 18 | error OnlyAuthCaptureEscrow(); |
| 19 | |
| 20 | /// @notice Constructor |
| 21 | /// @param authCaptureEscrow_ AuthCaptureEscrow singleton that created this token store |
| 22 | constructor(address authCaptureEscrow_) { |
| 23 | authCaptureEscrow = authCaptureEscrow_; |
| 24 | } |
| 25 | |
| 26 | /// @notice Send tokens to a recipient, called by escrow during capture/refund |
| 27 | /// |
| 28 | /// @param token The token being received |
| 29 | /// @param recipient Address to receive the tokens |
| 30 | /// @param amount Amount of tokens to receive |
| 31 | /// |
| 32 | /// @return success True if the transfer was successful |
| 33 | function sendTokens(address token, address recipient, uint256 amount) external returns (bool) { |
| 34 | if (msg.sender != authCaptureEscrow) revert OnlyAuthCaptureEscrow(); |
| 35 | SafeERC20.safeTransfer(IERC20(token), recipient, amount); |
| 36 | return true; |
| 37 | } |
| 38 | } |
| 39 |
92.0%
lib/commerce-payments/src/collectors/PreApprovalPaymentCollector.sol
Lines covered: 12 / 13 (92.0%)
| 1 | // SPDX-License-Identifier: MIT |
| 2 | pragma solidity ^0.8.28; |
| 3 | |
| 4 | import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; |
| 5 | import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; |
| 6 | |
| 7 | import {TokenCollector} from "./TokenCollector.sol"; |
| 8 | import {AuthCaptureEscrow} from "../AuthCaptureEscrow.sol"; |
| 9 | |
| 10 | /// @title PreApprovalPaymentCollector |
| 11 | /// |
| 12 | /// @notice Collect payments using pre-approval calls and ERC-20 allowances |
| 13 | /// |
| 14 | /// @author Coinbase (https://github.com/base/commerce-payments) |
| 15 | contract PreApprovalPaymentCollector is TokenCollector { |
| 16 | /// @inheritdoc TokenCollector |
| 17 | TokenCollector.CollectorType public constant override collectorType = TokenCollector.CollectorType.Payment; |
| 18 | |
| 19 | /// @notice Payment was pre-approved by payer |
| 20 | event PaymentPreApproved(bytes32 indexed paymentInfoHash); |
| 21 | |
| 22 | /// @notice Payment not pre-approved by payer |
| 23 | error PaymentNotPreApproved(bytes32 paymentInfoHash); |
| 24 | |
| 25 | /// @notice Payment already collected |
| 26 | error PaymentAlreadyCollected(bytes32 paymentInfoHash); |
| 27 | |
| 28 | /// @notice Payment already pre-approved by payer |
| 29 | error PaymentAlreadyPreApproved(bytes32 paymentInfoHash); |
| 30 | |
| 31 | /// @notice Track if a payment has been pre-approved |
| 32 | mapping(bytes32 paymentInfoHash => bool approved) public isPreApproved; |
| 33 | |
| 34 | /// @notice Constructor |
| 35 | /// |
| 36 | /// @param authCaptureEscrow_ AuthCaptureEscrow singleton that calls to collect tokens |
| 37 | constructor(address authCaptureEscrow_) TokenCollector(authCaptureEscrow_) {} |
| 38 | |
| 39 | /// @notice Registers payer's token approval for a specific payment |
| 40 | /// |
| 41 | /// @dev Must be called by the payer specified in the payment info |
| 42 | /// |
| 43 | /// @param paymentInfo PaymentInfo struct |
| 44 | function preApprove(AuthCaptureEscrow.PaymentInfo calldata paymentInfo) external { |
| 45 | // Check sender is payer |
| 46 | if (msg.sender != paymentInfo.payer) revert AuthCaptureEscrow.InvalidSender(msg.sender, paymentInfo.payer); |
| 47 | |
| 48 | // Check pre-approval expiry has not passed |
| 49 | if (block.timestamp >= paymentInfo.preApprovalExpiry) { |
| 50 | revert AuthCaptureEscrow.AfterPreApprovalExpiry(uint48(block.timestamp), paymentInfo.preApprovalExpiry); |
| 51 | } |
| 52 | |
| 53 | // Check has not already pre-approved |
| 54 | bytes32 paymentInfoHash = authCaptureEscrow.getHash(paymentInfo); |
| 55 | if (isPreApproved[paymentInfoHash]) revert PaymentAlreadyPreApproved(paymentInfoHash); |
| 56 | |
| 57 | // Check has not already collected |
| 58 | (bool hasCollectedPayment,,) = authCaptureEscrow.paymentState(paymentInfoHash); |
| 59 | if (hasCollectedPayment) revert PaymentAlreadyCollected(paymentInfoHash); |
| 60 | |
| 61 | // Set payment as pre-approved |
| 62 | isPreApproved[paymentInfoHash] = true; |
| 63 | emit PaymentPreApproved(paymentInfoHash); |
| 64 | } |
| 65 | |
| 66 | /// @inheritdoc TokenCollector |
| 67 | /// |
| 68 | /// @dev Requires pre-approval for a specific payment and an ERC-20 allowance to this collector |
| 69 | function _collectTokens( |
| 70 | AuthCaptureEscrow.PaymentInfo calldata paymentInfo, |
| 71 | address tokenStore, |
| 72 | uint256 amount, |
| 73 | bytes calldata |
| 74 | ) internal override { |
| 75 | // Check payment pre-approved |
| 76 | bytes32 paymentInfoHash = authCaptureEscrow.getHash(paymentInfo); |
| 77 | // Skip resetting pre-approval to save gas as the `AuthCaptureEscrow` enforces unique, single-lifecycle payments |
| 78 | if (!isPreApproved[paymentInfoHash]) revert PaymentNotPreApproved(paymentInfoHash); |
| 79 | // Transfer tokens from payer directly to token store |
| 80 | SafeERC20.safeTransferFrom(IERC20(paymentInfo.token), paymentInfo.payer, tokenStore, amount); |
| 81 | } |
| 82 | } |
| 83 |
66.0%
lib/commerce-payments/src/collectors/TokenCollector.sol
Lines covered: 2 / 3 (66.0%)
| 1 | // SPDX-License-Identifier: MIT |
| 2 | pragma solidity ^0.8.28; |
| 3 | |
| 4 | import {AuthCaptureEscrow} from "../AuthCaptureEscrow.sol"; |
| 5 | |
| 6 | /// @title TokenCollector |
| 7 | /// |
| 8 | /// @notice Abstract contract for shared token collector utilities |
| 9 | /// |
| 10 | /// @author Coinbase (https://github.com/base/commerce-payments) |
| 11 | abstract contract TokenCollector { |
| 12 | /// @notice Type differentiation between payment and refund collection flows |
| 13 | enum CollectorType { |
| 14 | Payment, |
| 15 | Refund |
| 16 | } |
| 17 | |
| 18 | /// @notice AuthCaptureEscrow singleton |
| 19 | AuthCaptureEscrow public immutable authCaptureEscrow; |
| 20 | |
| 21 | /// @notice Call sender is not AuthCaptureEscrow |
| 22 | error OnlyAuthCaptureEscrow(); |
| 23 | |
| 24 | /// @notice Constructor |
| 25 | /// |
| 26 | /// @param authCaptureEscrow_ AuthCaptureEscrow singleton that calls to collect tokens |
| 27 | constructor(address authCaptureEscrow_) { |
| 28 | authCaptureEscrow = AuthCaptureEscrow(authCaptureEscrow_); |
| 29 | } |
| 30 | |
| 31 | /// @notice Pull tokens from payer to escrow using token collector-specific authorization logic |
| 32 | /// |
| 33 | /// @param paymentInfo Payment info struct |
| 34 | /// @param tokenStore Address to collect tokens into |
| 35 | /// @param amount Amount of tokens to pull |
| 36 | /// @param collectorData Data to pass to the token collector |
| 37 | function collectTokens( |
| 38 | AuthCaptureEscrow.PaymentInfo calldata paymentInfo, |
| 39 | address tokenStore, |
| 40 | uint256 amount, |
| 41 | bytes calldata collectorData |
| 42 | ) external { |
| 43 | if (msg.sender != address(authCaptureEscrow)) revert OnlyAuthCaptureEscrow(); |
| 44 | _collectTokens(paymentInfo, tokenStore, amount, collectorData); |
| 45 | } |
| 46 | |
| 47 | /// @notice Get the type of token collector |
| 48 | /// |
| 49 | /// @return CollectorType Type of token collector |
| 50 | function collectorType() external view virtual returns (CollectorType); |
| 51 | |
| 52 | /// @notice Pull tokens from payer to escrow using token collector-specific authorization logic |
| 53 | /// |
| 54 | /// @param paymentInfo Payment info struct |
| 55 | /// @param tokenStore Address to collect tokens into |
| 56 | /// @param amount Amount of tokens to pull |
| 57 | /// @param collectorData Data to pass to the token collector |
| 58 | function _collectTokens( |
| 59 | AuthCaptureEscrow.PaymentInfo calldata paymentInfo, |
| 60 | address tokenStore, |
| 61 | uint256 amount, |
| 62 | bytes calldata collectorData |
| 63 | ) internal virtual; |
| 64 | |
| 65 | /// @notice Get hash for PaymentInfo with null payer address |
| 66 | /// |
| 67 | /// @param paymentInfo PaymentInfo struct with non-null payer address |
| 68 | /// |
| 69 | /// @return hash Hash of PaymentInfo with payer replaced with zero address |
| 70 | function _getHashPayerAgnostic(AuthCaptureEscrow.PaymentInfo memory paymentInfo) internal view returns (bytes32) { |
| 71 | address payer = paymentInfo.payer; |
| 72 | paymentInfo.payer = address(0); |
| 73 | bytes32 hashPayerAgnostic = authCaptureEscrow.getHash(paymentInfo); |
| 74 | // Proactively setting payer back to original value covers accidental bugs if memory location is then used elsewhere |
| 75 | paymentInfo.payer = payer; |
| 76 | return hashPayerAgnostic; |
| 77 | } |
| 78 | } |
| 79 |
0.0%
lib/forge-std/src/Base.sol
Lines covered: 0 / 0 (0.0%)
| 1 | // SPDX-License-Identifier: MIT |
| 2 | pragma solidity >=0.6.2 <0.9.0; |
| 3 | |
| 4 | import {StdStorage} from "./StdStorage.sol"; |
| 5 | import {Vm, VmSafe} from "./Vm.sol"; |
| 6 | |
| 7 | abstract contract CommonBase { |
| 8 | /// @dev Cheat code address. |
| 9 | /// Calculated as `address(uint160(uint256(keccak256("hevm cheat code"))))`. |
| 10 | address internal constant VM_ADDRESS = 0x7109709ECfa91a80626fF3989D68f67F5b1DD12D; |
| 11 | |
| 12 | /// @dev console.sol and console2.sol work by executing a staticcall to this address. |
| 13 | /// Calculated as `address(uint160(uint88(bytes11("console.log"))))`. |
| 14 | address internal constant CONSOLE = 0x000000000000000000636F6e736F6c652e6c6f67; |
| 15 | |
| 16 | /// @dev Used when deploying with create2. |
| 17 | /// Taken from https://github.com/Arachnid/deterministic-deployment-proxy. |
| 18 | address internal constant CREATE2_FACTORY = 0x4e59b44847b379578588920cA78FbF26c0B4956C; |
| 19 | |
| 20 | /// @dev The default address for tx.origin and msg.sender. |
| 21 | /// Calculated as `address(uint160(uint256(keccak256("foundry default caller"))))`. |
| 22 | address internal constant DEFAULT_SENDER = 0x1804c8AB1F12E6bbf3894d4083f33e07309d1f38; |
| 23 | |
| 24 | /// @dev The address of the first contract `CREATE`d by a running test contract. |
| 25 | /// When running tests, each test contract is `CREATE`d by `DEFAULT_SENDER` with nonce 1. |
| 26 | /// Calculated as `VM.computeCreateAddress(VM.computeCreateAddress(DEFAULT_SENDER, 1), 1)`. |
| 27 | address internal constant DEFAULT_TEST_CONTRACT = 0x5615dEB798BB3E4dFa0139dFa1b3D433Cc23b72f; |
| 28 | |
| 29 | /// @dev Deterministic deployment address of the Multicall3 contract. |
| 30 | /// Taken from https://www.multicall3.com. |
| 31 | address internal constant MULTICALL3_ADDRESS = 0xcA11bde05977b3631167028862bE2a173976CA11; |
| 32 | |
| 33 | /// @dev The order of the secp256k1 curve. |
| 34 | uint256 internal constant SECP256K1_ORDER = |
| 35 | 115792089237316195423570985008687907852837564279074904382605163141518161494337; |
| 36 | |
| 37 | uint256 internal constant UINT256_MAX = |
| 38 | 115792089237316195423570985008687907853269984665640564039457584007913129639935; |
| 39 | |
| 40 | Vm internal constant vm = Vm(VM_ADDRESS); |
| 41 | StdStorage internal stdstore; |
| 42 | } |
| 43 | |
| 44 | abstract contract TestBase is CommonBase {} |
| 45 | |
| 46 | abstract contract ScriptBase is CommonBase { |
| 47 | VmSafe internal constant vmSafe = VmSafe(VM_ADDRESS); |
| 48 | } |
| 49 |
83.0%
lib/forge-std/src/StdAssertions.sol
Lines covered: 5 / 6 (83.0%)
| 1 | // SPDX-License-Identifier: MIT |
| 2 | pragma solidity >=0.6.2 <0.9.0; |
| 3 | pragma experimental ABIEncoderV2; |
| 4 | |
| 5 | import {Vm} from "./Vm.sol"; |
| 6 | |
| 7 | abstract contract StdAssertions { |
| 8 | Vm private constant vm = Vm(address(uint160(uint256(keccak256("hevm cheat code"))))); |
| 9 | |
| 10 | event log(string); |
| 11 | event logs(bytes); |
| 12 | |
| 13 | event log_address(address); |
| 14 | event log_bytes32(bytes32); |
| 15 | event log_int(int256); |
| 16 | event log_uint(uint256); |
| 17 | event log_bytes(bytes); |
| 18 | event log_string(string); |
| 19 | |
| 20 | event log_named_address(string key, address val); |
| 21 | event log_named_bytes32(string key, bytes32 val); |
| 22 | event log_named_decimal_int(string key, int256 val, uint256 decimals); |
| 23 | event log_named_decimal_uint(string key, uint256 val, uint256 decimals); |
| 24 | event log_named_int(string key, int256 val); |
| 25 | event log_named_uint(string key, uint256 val); |
| 26 | event log_named_bytes(string key, bytes val); |
| 27 | event log_named_string(string key, string val); |
| 28 | |
| 29 | event log_array(uint256[] val); |
| 30 | event log_array(int256[] val); |
| 31 | event log_array(address[] val); |
| 32 | event log_named_array(string key, uint256[] val); |
| 33 | event log_named_array(string key, int256[] val); |
| 34 | event log_named_array(string key, address[] val); |
| 35 | |
| 36 | bytes32 private constant FAILED_SLOT = bytes32("failed"); |
| 37 | |
| 38 | bool private _failed; |
| 39 | |
| 40 | function failed() public view returns (bool) { |
| 41 | if (_failed) { |
| 42 | return true; |
| 43 | } else { |
| 44 | return vm.load(address(vm), FAILED_SLOT) != bytes32(0); |
| 45 | } |
| 46 | } |
| 47 | |
| 48 | function fail() internal virtual { |
| 49 | vm.store(address(vm), FAILED_SLOT, bytes32(uint256(1))); |
| 50 | _failed = true; |
| 51 | } |
| 52 | |
| 53 | function fail(string memory message) internal virtual { |
| 54 | fail(); |
| 55 | vm.assertTrue(false, message); |
| 56 | } |
| 57 | |
| 58 | function assertTrue(bool data) internal pure virtual { |
| 59 | if (!data) { |
| 60 | vm.assertTrue(data); |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | function assertTrue(bool data, string memory err) internal pure virtual { |
| 65 | if (!data) { |
| 66 | vm.assertTrue(data, err); |
| 67 | } |
| 68 | } |
| 69 | |
| 70 | function assertFalse(bool data) internal pure virtual { |
| 71 | if (data) { |
| 72 | vm.assertFalse(data); |
| 73 | } |
| 74 | } |
| 75 | |
| 76 | function assertFalse(bool data, string memory err) internal pure virtual { |
| 77 | if (data) { |
| 78 | vm.assertFalse(data, err); |
| 79 | } |
| 80 | } |
| 81 | |
| 82 | function assertEq(bool left, bool right) internal pure virtual { |
| 83 | if (left != right) { |
| 84 | vm.assertEq(left, right); |
| 85 | } |
| 86 | } |
| 87 | |
| 88 | function assertEq(bool left, bool right, string memory err) internal pure virtual { |
| 89 | if (left != right) { |
| 90 | vm.assertEq(left, right, err); |
| 91 | } |
| 92 | } |
| 93 | |
| 94 | function assertEq(uint256 left, uint256 right) internal pure virtual { |
| 95 | if (left != right) { |
| 96 | vm.assertEq(left, right); |
| 97 | } |
| 98 | } |
| 99 | |
| 100 | function assertEq(uint256 left, uint256 right, string memory err) internal pure virtual { |
| 101 | if (left != right) { |
| 102 | vm.assertEq(left, right, err); |
| 103 | } |
| 104 | } |
| 105 | |
| 106 | function assertEqDecimal(uint256 left, uint256 right, uint256 decimals) internal pure virtual { |
| 107 | vm.assertEqDecimal(left, right, decimals); |
| 108 | } |
| 109 | |
| 110 | function assertEqDecimal(uint256 left, uint256 right, uint256 decimals, string memory err) internal pure virtual { |
| 111 | vm.assertEqDecimal(left, right, decimals, err); |
| 112 | } |
| 113 | |
| 114 | function assertEq(int256 left, int256 right) internal pure virtual { |
| 115 | if (left != right) { |
| 116 | vm.assertEq(left, right); |
| 117 | } |
| 118 | } |
| 119 | |
| 120 | function assertEq(int256 left, int256 right, string memory err) internal pure virtual { |
| 121 | if (left != right) { |
| 122 | vm.assertEq(left, right, err); |
| 123 | } |
| 124 | } |
| 125 | |
| 126 | function assertEqDecimal(int256 left, int256 right, uint256 decimals) internal pure virtual { |
| 127 | vm.assertEqDecimal(left, right, decimals); |
| 128 | } |
| 129 | |
| 130 | function assertEqDecimal(int256 left, int256 right, uint256 decimals, string memory err) internal pure virtual { |
| 131 | vm.assertEqDecimal(left, right, decimals, err); |
| 132 | } |
| 133 | |
| 134 | function assertEq(address left, address right) internal pure virtual { |
| 135 | if (left != right) { |
| 136 | vm.assertEq(left, right); |
| 137 | } |
| 138 | } |
| 139 | |
| 140 | function assertEq(address left, address right, string memory err) internal pure virtual { |
| 141 | if (left != right) { |
| 142 | vm.assertEq(left, right, err); |
| 143 | } |
| 144 | } |
| 145 | |
| 146 | function assertEq(bytes32 left, bytes32 right) internal pure virtual { |
| 147 | if (left != right) { |
| 148 | vm.assertEq(left, right); |
| 149 | } |
| 150 | } |
| 151 | |
| 152 | function assertEq(bytes32 left, bytes32 right, string memory err) internal pure virtual { |
| 153 | if (left != right) { |
| 154 | vm.assertEq(left, right, err); |
| 155 | } |
| 156 | } |
| 157 | |
| 158 | function assertEq32(bytes32 left, bytes32 right) internal pure virtual { |
| 159 | if (left != right) { |
| 160 | vm.assertEq(left, right); |
| 161 | } |
| 162 | } |
| 163 | |
| 164 | function assertEq32(bytes32 left, bytes32 right, string memory err) internal pure virtual { |
| 165 | if (left != right) { |
| 166 | vm.assertEq(left, right, err); |
| 167 | } |
| 168 | } |
| 169 | |
| 170 | function assertEq(string memory left, string memory right) internal pure virtual { |
| 171 | vm.assertEq(left, right); |
| 172 | } |
| 173 | |
| 174 | function assertEq(string memory left, string memory right, string memory err) internal pure virtual { |
| 175 | vm.assertEq(left, right, err); |
| 176 | } |
| 177 | |
| 178 | function assertEq(bytes memory left, bytes memory right) internal pure virtual { |
| 179 | vm.assertEq(left, right); |
| 180 | } |
| 181 | |
| 182 | function assertEq(bytes memory left, bytes memory right, string memory err) internal pure virtual { |
| 183 | vm.assertEq(left, right, err); |
| 184 | } |
| 185 | |
| 186 | function assertEq(bool[] memory left, bool[] memory right) internal pure virtual { |
| 187 | vm.assertEq(left, right); |
| 188 | } |
| 189 | |
| 190 | function assertEq(bool[] memory left, bool[] memory right, string memory err) internal pure virtual { |
| 191 | vm.assertEq(left, right, err); |
| 192 | } |
| 193 | |
| 194 | function assertEq(uint256[] memory left, uint256[] memory right) internal pure virtual { |
| 195 | vm.assertEq(left, right); |
| 196 | } |
| 197 | |
| 198 | function assertEq(uint256[] memory left, uint256[] memory right, string memory err) internal pure virtual { |
| 199 | vm.assertEq(left, right, err); |
| 200 | } |
| 201 | |
| 202 | function assertEq(int256[] memory left, int256[] memory right) internal pure virtual { |
| 203 | vm.assertEq(left, right); |
| 204 | } |
| 205 | |
| 206 | function assertEq(int256[] memory left, int256[] memory right, string memory err) internal pure virtual { |
| 207 | vm.assertEq(left, right, err); |
| 208 | } |
| 209 | |
| 210 | function assertEq(address[] memory left, address[] memory right) internal pure virtual { |
| 211 | vm.assertEq(left, right); |
| 212 | } |
| 213 | |
| 214 | function assertEq(address[] memory left, address[] memory right, string memory err) internal pure virtual { |
| 215 | vm.assertEq(left, right, err); |
| 216 | } |
| 217 | |
| 218 | function assertEq(bytes32[] memory left, bytes32[] memory right) internal pure virtual { |
| 219 | vm.assertEq(left, right); |
| 220 | } |
| 221 | |
| 222 | function assertEq(bytes32[] memory left, bytes32[] memory right, string memory err) internal pure virtual { |
| 223 | vm.assertEq(left, right, err); |
| 224 | } |
| 225 | |
| 226 | function assertEq(string[] memory left, string[] memory right) internal pure virtual { |
| 227 | vm.assertEq(left, right); |
| 228 | } |
| 229 | |
| 230 | function assertEq(string[] memory left, string[] memory right, string memory err) internal pure virtual { |
| 231 | vm.assertEq(left, right, err); |
| 232 | } |
| 233 | |
| 234 | function assertEq(bytes[] memory left, bytes[] memory right) internal pure virtual { |
| 235 | vm.assertEq(left, right); |
| 236 | } |
| 237 | |
| 238 | function assertEq(bytes[] memory left, bytes[] memory right, string memory err) internal pure virtual { |
| 239 | vm.assertEq(left, right, err); |
| 240 | } |
| 241 | |
| 242 | // Legacy helper |
| 243 | function assertEqUint(uint256 left, uint256 right) internal pure virtual { |
| 244 | assertEq(left, right); |
| 245 | } |
| 246 | |
| 247 | function assertNotEq(bool left, bool right) internal pure virtual { |
| 248 | if (left == right) { |
| 249 | vm.assertNotEq(left, right); |
| 250 | } |
| 251 | } |
| 252 | |
| 253 | function assertNotEq(bool left, bool right, string memory err) internal pure virtual { |
| 254 | if (left == right) { |
| 255 | vm.assertNotEq(left, right, err); |
| 256 | } |
| 257 | } |
| 258 | |
| 259 | function assertNotEq(uint256 left, uint256 right) internal pure virtual { |
| 260 | if (left == right) { |
| 261 | vm.assertNotEq(left, right); |
| 262 | } |
| 263 | } |
| 264 | |
| 265 | function assertNotEq(uint256 left, uint256 right, string memory err) internal pure virtual { |
| 266 | if (left == right) { |
| 267 | vm.assertNotEq(left, right, err); |
| 268 | } |
| 269 | } |
| 270 | |
| 271 | function assertNotEqDecimal(uint256 left, uint256 right, uint256 decimals) internal pure virtual { |
| 272 | vm.assertNotEqDecimal(left, right, decimals); |
| 273 | } |
| 274 | |
| 275 | function assertNotEqDecimal(uint256 left, uint256 right, uint256 decimals, string memory err) |
| 276 | internal |
| 277 | pure |
| 278 | virtual |
| 279 | { |
| 280 | vm.assertNotEqDecimal(left, right, decimals, err); |
| 281 | } |
| 282 | |
| 283 | function assertNotEq(int256 left, int256 right) internal pure virtual { |
| 284 | if (left == right) { |
| 285 | vm.assertNotEq(left, right); |
| 286 | } |
| 287 | } |
| 288 | |
| 289 | function assertNotEq(int256 left, int256 right, string memory err) internal pure virtual { |
| 290 | if (left == right) { |
| 291 | vm.assertNotEq(left, right, err); |
| 292 | } |
| 293 | } |
| 294 | |
| 295 | function assertNotEqDecimal(int256 left, int256 right, uint256 decimals) internal pure virtual { |
| 296 | vm.assertNotEqDecimal(left, right, decimals); |
| 297 | } |
| 298 | |
| 299 | function assertNotEqDecimal(int256 left, int256 right, uint256 decimals, string memory err) internal pure virtual { |
| 300 | vm.assertNotEqDecimal(left, right, decimals, err); |
| 301 | } |
| 302 | |
| 303 | function assertNotEq(address left, address right) internal pure virtual { |
| 304 | if (left == right) { |
| 305 | vm.assertNotEq(left, right); |
| 306 | } |
| 307 | } |
| 308 | |
| 309 | function assertNotEq(address left, address right, string memory err) internal pure virtual { |
| 310 | if (left == right) { |
| 311 | vm.assertNotEq(left, right, err); |
| 312 | } |
| 313 | } |
| 314 | |
| 315 | function assertNotEq(bytes32 left, bytes32 right) internal pure virtual { |
| 316 | if (left == right) { |
| 317 | vm.assertNotEq(left, right); |
| 318 | } |
| 319 | } |
| 320 | |
| 321 | function assertNotEq(bytes32 left, bytes32 right, string memory err) internal pure virtual { |
| 322 | if (left == right) { |
| 323 | vm.assertNotEq(left, right, err); |
| 324 | } |
| 325 | } |
| 326 | |
| 327 | function assertNotEq32(bytes32 left, bytes32 right) internal pure virtual { |
| 328 | if (left == right) { |
| 329 | vm.assertNotEq(left, right); |
| 330 | } |
| 331 | } |
| 332 | |
| 333 | function assertNotEq32(bytes32 left, bytes32 right, string memory err) internal pure virtual { |
| 334 | if (left == right) { |
| 335 | vm.assertNotEq(left, right, err); |
| 336 | } |
| 337 | } |
| 338 | |
| 339 | function assertNotEq(string memory left, string memory right) internal pure virtual { |
| 340 | vm.assertNotEq(left, right); |
| 341 | } |
| 342 | |
| 343 | function assertNotEq(string memory left, string memory right, string memory err) internal pure virtual { |
| 344 | vm.assertNotEq(left, right, err); |
| 345 | } |
| 346 | |
| 347 | function assertNotEq(bytes memory left, bytes memory right) internal pure virtual { |
| 348 | vm.assertNotEq(left, right); |
| 349 | } |
| 350 | |
| 351 | function assertNotEq(bytes memory left, bytes memory right, string memory err) internal pure virtual { |
| 352 | vm.assertNotEq(left, right, err); |
| 353 | } |
| 354 | |
| 355 | function assertNotEq(bool[] memory left, bool[] memory right) internal pure virtual { |
| 356 | vm.assertNotEq(left, right); |
| 357 | } |
| 358 | |
| 359 | function assertNotEq(bool[] memory left, bool[] memory right, string memory err) internal pure virtual { |
| 360 | vm.assertNotEq(left, right, err); |
| 361 | } |
| 362 | |
| 363 | function assertNotEq(uint256[] memory left, uint256[] memory right) internal pure virtual { |
| 364 | vm.assertNotEq(left, right); |
| 365 | } |
| 366 | |
| 367 | function assertNotEq(uint256[] memory left, uint256[] memory right, string memory err) internal pure virtual { |
| 368 | vm.assertNotEq(left, right, err); |
| 369 | } |
| 370 | |
| 371 | function assertNotEq(int256[] memory left, int256[] memory right) internal pure virtual { |
| 372 | vm.assertNotEq(left, right); |
| 373 | } |
| 374 | |
| 375 | function assertNotEq(int256[] memory left, int256[] memory right, string memory err) internal pure virtual { |
| 376 | vm.assertNotEq(left, right, err); |
| 377 | } |
| 378 | |
| 379 | function assertNotEq(address[] memory left, address[] memory right) internal pure virtual { |
| 380 | vm.assertNotEq(left, right); |
| 381 | } |
| 382 | |
| 383 | function assertNotEq(address[] memory left, address[] memory right, string memory err) internal pure virtual { |
| 384 | vm.assertNotEq(left, right, err); |
| 385 | } |
| 386 | |
| 387 | function assertNotEq(bytes32[] memory left, bytes32[] memory right) internal pure virtual { |
| 388 | vm.assertNotEq(left, right); |
| 389 | } |
| 390 | |
| 391 | function assertNotEq(bytes32[] memory left, bytes32[] memory right, string memory err) internal pure virtual { |
| 392 | vm.assertNotEq(left, right, err); |
| 393 | } |
| 394 | |
| 395 | function assertNotEq(string[] memory left, string[] memory right) internal pure virtual { |
| 396 | vm.assertNotEq(left, right); |
| 397 | } |
| 398 | |
| 399 | function assertNotEq(string[] memory left, string[] memory right, string memory err) internal pure virtual { |
| 400 | vm.assertNotEq(left, right, err); |
| 401 | } |
| 402 | |
| 403 | function assertNotEq(bytes[] memory left, bytes[] memory right) internal pure virtual { |
| 404 | vm.assertNotEq(left, right); |
| 405 | } |
| 406 | |
| 407 | function assertNotEq(bytes[] memory left, bytes[] memory right, string memory err) internal pure virtual { |
| 408 | vm.assertNotEq(left, right, err); |
| 409 | } |
| 410 | |
| 411 | function assertLt(uint256 left, uint256 right) internal pure virtual { |
| 412 | if (left >= right) { |
| 413 | vm.assertLt(left, right); |
| 414 | } |
| 415 | } |
| 416 | |
| 417 | function assertLt(uint256 left, uint256 right, string memory err) internal pure virtual { |
| 418 | if (left >= right) { |
| 419 | vm.assertLt(left, right, err); |
| 420 | } |
| 421 | } |
| 422 | |
| 423 | function assertLtDecimal(uint256 left, uint256 right, uint256 decimals) internal pure virtual { |
| 424 | vm.assertLtDecimal(left, right, decimals); |
| 425 | } |
| 426 | |
| 427 | function assertLtDecimal(uint256 left, uint256 right, uint256 decimals, string memory err) internal pure virtual { |
| 428 | vm.assertLtDecimal(left, right, decimals, err); |
| 429 | } |
| 430 | |
| 431 | function assertLt(int256 left, int256 right) internal pure virtual { |
| 432 | if (left >= right) { |
| 433 | vm.assertLt(left, right); |
| 434 | } |
| 435 | } |
| 436 | |
| 437 | function assertLt(int256 left, int256 right, string memory err) internal pure virtual { |
| 438 | if (left >= right) { |
| 439 | vm.assertLt(left, right, err); |
| 440 | } |
| 441 | } |
| 442 | |
| 443 | function assertLtDecimal(int256 left, int256 right, uint256 decimals) internal pure virtual { |
| 444 | vm.assertLtDecimal(left, right, decimals); |
| 445 | } |
| 446 | |
| 447 | function assertLtDecimal(int256 left, int256 right, uint256 decimals, string memory err) internal pure virtual { |
| 448 | vm.assertLtDecimal(left, right, decimals, err); |
| 449 | } |
| 450 | |
| 451 | function assertGt(uint256 left, uint256 right) internal pure virtual { |
| 452 | if (left <= right) { |
| 453 | vm.assertGt(left, right); |
| 454 | } |
| 455 | } |
| 456 | |
| 457 | function assertGt(uint256 left, uint256 right, string memory err) internal pure virtual { |
| 458 | if (left <= right) { |
| 459 | vm.assertGt(left, right, err); |
| 460 | } |
| 461 | } |
| 462 | |
| 463 | function assertGtDecimal(uint256 left, uint256 right, uint256 decimals) internal pure virtual { |
| 464 | vm.assertGtDecimal(left, right, decimals); |
| 465 | } |
| 466 | |
| 467 | function assertGtDecimal(uint256 left, uint256 right, uint256 decimals, string memory err) internal pure virtual { |
| 468 | vm.assertGtDecimal(left, right, decimals, err); |
| 469 | } |
| 470 | |
| 471 | function assertGt(int256 left, int256 right) internal pure virtual { |
| 472 | if (left <= right) { |
| 473 | vm.assertGt(left, right); |
| 474 | } |
| 475 | } |
| 476 | |
| 477 | function assertGt(int256 left, int256 right, string memory err) internal pure virtual { |
| 478 | if (left <= right) { |
| 479 | vm.assertGt(left, right, err); |
| 480 | } |
| 481 | } |
| 482 | |
| 483 | function assertGtDecimal(int256 left, int256 right, uint256 decimals) internal pure virtual { |
| 484 | vm.assertGtDecimal(left, right, decimals); |
| 485 | } |
| 486 | |
| 487 | function assertGtDecimal(int256 left, int256 right, uint256 decimals, string memory err) internal pure virtual { |
| 488 | vm.assertGtDecimal(left, right, decimals, err); |
| 489 | } |
| 490 | |
| 491 | function assertLe(uint256 left, uint256 right) internal pure virtual { |
| 492 | if (left > right) { |
| 493 | vm.assertLe(left, right); |
| 494 | } |
| 495 | } |
| 496 | |
| 497 | function assertLe(uint256 left, uint256 right, string memory err) internal pure virtual { |
| 498 | if (left > right) { |
| 499 | vm.assertLe(left, right, err); |
| 500 | } |
| 501 | } |
| 502 | |
| 503 | function assertLeDecimal(uint256 left, uint256 right, uint256 decimals) internal pure virtual { |
| 504 | vm.assertLeDecimal(left, right, decimals); |
| 505 | } |
| 506 | |
| 507 | function assertLeDecimal(uint256 left, uint256 right, uint256 decimals, string memory err) internal pure virtual { |
| 508 | vm.assertLeDecimal(left, right, decimals, err); |
| 509 | } |
| 510 | |
| 511 | function assertLe(int256 left, int256 right) internal pure virtual { |
| 512 | if (left > right) { |
| 513 | vm.assertLe(left, right); |
| 514 | } |
| 515 | } |
| 516 | |
| 517 | function assertLe(int256 left, int256 right, string memory err) internal pure virtual { |
| 518 | if (left > right) { |
| 519 | vm.assertLe(left, right, err); |
| 520 | } |
| 521 | } |
| 522 | |
| 523 | function assertLeDecimal(int256 left, int256 right, uint256 decimals) internal pure virtual { |
| 524 | vm.assertLeDecimal(left, right, decimals); |
| 525 | } |
| 526 | |
| 527 | function assertLeDecimal(int256 left, int256 right, uint256 decimals, string memory err) internal pure virtual { |
| 528 | vm.assertLeDecimal(left, right, decimals, err); |
| 529 | } |
| 530 | |
| 531 | function assertGe(uint256 left, uint256 right) internal pure virtual { |
| 532 | if (left < right) { |
| 533 | vm.assertGe(left, right); |
| 534 | } |
| 535 | } |
| 536 | |
| 537 | function assertGe(uint256 left, uint256 right, string memory err) internal pure virtual { |
| 538 | if (left < right) { |
| 539 | vm.assertGe(left, right, err); |
| 540 | } |
| 541 | } |
| 542 | |
| 543 | function assertGeDecimal(uint256 left, uint256 right, uint256 decimals) internal pure virtual { |
| 544 | vm.assertGeDecimal(left, right, decimals); |
| 545 | } |
| 546 | |
| 547 | function assertGeDecimal(uint256 left, uint256 right, uint256 decimals, string memory err) internal pure virtual { |
| 548 | vm.assertGeDecimal(left, right, decimals, err); |
| 549 | } |
| 550 | |
| 551 | function assertGe(int256 left, int256 right) internal pure virtual { |
| 552 | if (left < right) { |
| 553 | vm.assertGe(left, right); |
| 554 | } |
| 555 | } |
| 556 | |
| 557 | function assertGe(int256 left, int256 right, string memory err) internal pure virtual { |
| 558 | if (left < right) { |
| 559 | vm.assertGe(left, right, err); |
| 560 | } |
| 561 | } |
| 562 | |
| 563 | function assertGeDecimal(int256 left, int256 right, uint256 decimals) internal pure virtual { |
| 564 | vm.assertGeDecimal(left, right, decimals); |
| 565 | } |
| 566 | |
| 567 | function assertGeDecimal(int256 left, int256 right, uint256 decimals, string memory err) internal pure virtual { |
| 568 | vm.assertGeDecimal(left, right, decimals, err); |
| 569 | } |
| 570 | |
| 571 | function assertApproxEqAbs(uint256 left, uint256 right, uint256 maxDelta) internal pure virtual { |
| 572 | vm.assertApproxEqAbs(left, right, maxDelta); |
| 573 | } |
| 574 | |
| 575 | function assertApproxEqAbs(uint256 left, uint256 right, uint256 maxDelta, string memory err) internal pure virtual { |
| 576 | vm.assertApproxEqAbs(left, right, maxDelta, err); |
| 577 | } |
| 578 | |
| 579 | function assertApproxEqAbsDecimal(uint256 left, uint256 right, uint256 maxDelta, uint256 decimals) |
| 580 | internal |
| 581 | pure |
| 582 | virtual |
| 583 | { |
| 584 | vm.assertApproxEqAbsDecimal(left, right, maxDelta, decimals); |
| 585 | } |
| 586 | |
| 587 | function assertApproxEqAbsDecimal( |
| 588 | uint256 left, |
| 589 | uint256 right, |
| 590 | uint256 maxDelta, |
| 591 | uint256 decimals, |
| 592 | string memory err |
| 593 | ) internal pure virtual { |
| 594 | vm.assertApproxEqAbsDecimal(left, right, maxDelta, decimals, err); |
| 595 | } |
| 596 | |
| 597 | function assertApproxEqAbs(int256 left, int256 right, uint256 maxDelta) internal pure virtual { |
| 598 | vm.assertApproxEqAbs(left, right, maxDelta); |
| 599 | } |
| 600 | |
| 601 | function assertApproxEqAbs(int256 left, int256 right, uint256 maxDelta, string memory err) internal pure virtual { |
| 602 | vm.assertApproxEqAbs(left, right, maxDelta, err); |
| 603 | } |
| 604 | |
| 605 | function assertApproxEqAbsDecimal(int256 left, int256 right, uint256 maxDelta, uint256 decimals) |
| 606 | internal |
| 607 | pure |
| 608 | virtual |
| 609 | { |
| 610 | vm.assertApproxEqAbsDecimal(left, right, maxDelta, decimals); |
| 611 | } |
| 612 | |
| 613 | function assertApproxEqAbsDecimal(int256 left, int256 right, uint256 maxDelta, uint256 decimals, string memory err) |
| 614 | internal |
| 615 | pure |
| 616 | virtual |
| 617 | { |
| 618 | vm.assertApproxEqAbsDecimal(left, right, maxDelta, decimals, err); |
| 619 | } |
| 620 | |
| 621 | function assertApproxEqRel( |
| 622 | uint256 left, |
| 623 | uint256 right, |
| 624 | uint256 maxPercentDelta // An 18 decimal fixed point number, where 1e18 == 100% |
| 625 | ) |
| 626 | internal |
| 627 | pure |
| 628 | virtual |
| 629 | { |
| 630 | vm.assertApproxEqRel(left, right, maxPercentDelta); |
| 631 | } |
| 632 | |
| 633 | function assertApproxEqRel( |
| 634 | uint256 left, |
| 635 | uint256 right, |
| 636 | uint256 maxPercentDelta, // An 18 decimal fixed point number, where 1e18 == 100% |
| 637 | string memory err |
| 638 | ) |
| 639 | internal |
| 640 | pure |
| 641 | virtual |
| 642 | { |
| 643 | vm.assertApproxEqRel(left, right, maxPercentDelta, err); |
| 644 | } |
| 645 | |
| 646 | function assertApproxEqRelDecimal( |
| 647 | uint256 left, |
| 648 | uint256 right, |
| 649 | uint256 maxPercentDelta, // An 18 decimal fixed point number, where 1e18 == 100% |
| 650 | uint256 decimals |
| 651 | ) |
| 652 | internal |
| 653 | pure |
| 654 | virtual |
| 655 | { |
| 656 | vm.assertApproxEqRelDecimal(left, right, maxPercentDelta, decimals); |
| 657 | } |
| 658 | |
| 659 | function assertApproxEqRelDecimal( |
| 660 | uint256 left, |
| 661 | uint256 right, |
| 662 | uint256 maxPercentDelta, // An 18 decimal fixed point number, where 1e18 == 100% |
| 663 | uint256 decimals, |
| 664 | string memory err |
| 665 | ) internal pure virtual { |
| 666 | vm.assertApproxEqRelDecimal(left, right, maxPercentDelta, decimals, err); |
| 667 | } |
| 668 | |
| 669 | function assertApproxEqRel(int256 left, int256 right, uint256 maxPercentDelta) internal pure virtual { |
| 670 | vm.assertApproxEqRel(left, right, maxPercentDelta); |
| 671 | } |
| 672 | |
| 673 | function assertApproxEqRel( |
| 674 | int256 left, |
| 675 | int256 right, |
| 676 | uint256 maxPercentDelta, // An 18 decimal fixed point number, where 1e18 == 100% |
| 677 | string memory err |
| 678 | ) |
| 679 | internal |
| 680 | pure |
| 681 | virtual |
| 682 | { |
| 683 | vm.assertApproxEqRel(left, right, maxPercentDelta, err); |
| 684 | } |
| 685 | |
| 686 | function assertApproxEqRelDecimal( |
| 687 | int256 left, |
| 688 | int256 right, |
| 689 | uint256 maxPercentDelta, // An 18 decimal fixed point number, where 1e18 == 100% |
| 690 | uint256 decimals |
| 691 | ) |
| 692 | internal |
| 693 | pure |
| 694 | virtual |
| 695 | { |
| 696 | vm.assertApproxEqRelDecimal(left, right, maxPercentDelta, decimals); |
| 697 | } |
| 698 | |
| 699 | function assertApproxEqRelDecimal( |
| 700 | int256 left, |
| 701 | int256 right, |
| 702 | uint256 maxPercentDelta, // An 18 decimal fixed point number, where 1e18 == 100% |
| 703 | uint256 decimals, |
| 704 | string memory err |
| 705 | ) internal pure virtual { |
| 706 | vm.assertApproxEqRelDecimal(left, right, maxPercentDelta, decimals, err); |
| 707 | } |
| 708 | |
| 709 | // Inherited from DSTest, not used but kept for backwards-compatibility |
| 710 | function checkEq0(bytes memory left, bytes memory right) internal pure returns (bool) { |
| 711 | return keccak256(left) == keccak256(right); |
| 712 | } |
| 713 | |
| 714 | function assertEq0(bytes memory left, bytes memory right) internal pure virtual { |
| 715 | assertEq(left, right); |
| 716 | } |
| 717 | |
| 718 | function assertEq0(bytes memory left, bytes memory right, string memory err) internal pure virtual { |
| 719 | assertEq(left, right, err); |
| 720 | } |
| 721 | |
| 722 | function assertNotEq0(bytes memory left, bytes memory right) internal pure virtual { |
| 723 | assertNotEq(left, right); |
| 724 | } |
| 725 | |
| 726 | function assertNotEq0(bytes memory left, bytes memory right, string memory err) internal pure virtual { |
| 727 | assertNotEq(left, right, err); |
| 728 | } |
| 729 | |
| 730 | function assertEqCall(address target, bytes memory callDataA, bytes memory callDataB) internal virtual { |
| 731 | assertEqCall(target, callDataA, target, callDataB, true); |
| 732 | } |
| 733 | |
| 734 | function assertEqCall(address targetA, bytes memory callDataA, address targetB, bytes memory callDataB) |
| 735 | internal |
| 736 | virtual |
| 737 | { |
| 738 | assertEqCall(targetA, callDataA, targetB, callDataB, true); |
| 739 | } |
| 740 | |
| 741 | function assertEqCall(address target, bytes memory callDataA, bytes memory callDataB, bool strictRevertData) |
| 742 | internal |
| 743 | virtual |
| 744 | { |
| 745 | assertEqCall(target, callDataA, target, callDataB, strictRevertData); |
| 746 | } |
| 747 | |
| 748 | function assertEqCall( |
| 749 | address targetA, |
| 750 | bytes memory callDataA, |
| 751 | address targetB, |
| 752 | bytes memory callDataB, |
| 753 | bool strictRevertData |
| 754 | ) internal virtual { |
| 755 | (bool successA, bytes memory returnDataA) = address(targetA).call(callDataA); |
| 756 | (bool successB, bytes memory returnDataB) = address(targetB).call(callDataB); |
| 757 | |
| 758 | if (successA && successB) { |
| 759 | assertEq(returnDataA, returnDataB, "Call return data does not match"); |
| 760 | } |
| 761 | |
| 762 | if (!successA && !successB && strictRevertData) { |
| 763 | assertEq(returnDataA, returnDataB, "Call revert data does not match"); |
| 764 | } |
| 765 | |
| 766 | if (!successA && successB) { |
| 767 | emit log("Error: Calls were not equal"); |
| 768 | emit log_named_bytes(" Left call revert data", returnDataA); |
| 769 | emit log_named_bytes(" Right call return data", returnDataB); |
| 770 | revert("assertion failed"); |
| 771 | } |
| 772 | |
| 773 | if (successA && !successB) { |
| 774 | emit log("Error: Calls were not equal"); |
| 775 | emit log_named_bytes(" Left call return data", returnDataA); |
| 776 | emit log_named_bytes(" Right call revert data", returnDataB); |
| 777 | revert("assertion failed"); |
| 778 | } |
| 779 | } |
| 780 | } |
| 781 |
100.0%
lib/forge-std/src/StdChains.sol
Lines covered: 1 / 1 (100.0%)
| 1 | // SPDX-License-Identifier: MIT |
| 2 | pragma solidity >=0.6.2 <0.9.0; |
| 3 | pragma experimental ABIEncoderV2; |
| 4 | |
| 5 | import {VmSafe} from "./Vm.sol"; |
| 6 | |
| 7 | /** |
| 8 | * StdChains provides information about EVM compatible chains that can be used in scripts/tests. |
| 9 | * For each chain, the chain's name, chain ID, and a default RPC URL are provided. Chains are |
| 10 | * identified by their alias, which is the same as the alias in the `[rpc_endpoints]` section of |
| 11 | * the `foundry.toml` file. For best UX, ensure the alias in the `foundry.toml` file match the |
| 12 | * alias used in this contract, which can be found as the first argument to the |
| 13 | * `setChainWithDefaultRpcUrl` call in the `initializeStdChains` function. |
| 14 | * |
| 15 | * There are two main ways to use this contract: |
| 16 | * 1. Set a chain with `setChain(string memory chainAlias, ChainData memory chain)` or |
| 17 | * `setChain(string memory chainAlias, Chain memory chain)` |
| 18 | * 2. Get a chain with `getChain(string memory chainAlias)` or `getChain(uint256 chainId)`. |
| 19 | * |
| 20 | * The first time either of those are used, chains are initialized with the default set of RPC URLs. |
| 21 | * This is done in `initializeStdChains`, which uses `setChainWithDefaultRpcUrl`. Defaults are recorded in |
| 22 | * `defaultRpcUrls`. |
| 23 | * |
| 24 | * The `setChain` function is straightforward, and it simply saves off the given chain data. |
| 25 | * |
| 26 | * The `getChain` methods use `getChainWithUpdatedRpcUrl` to return a chain. For example, let's say |
| 27 | * we want to retrieve the RPC URL for `mainnet`: |
| 28 | * - If you have specified data with `setChain`, it will return that. |
| 29 | * - If you have configured a mainnet RPC URL in `foundry.toml`, it will return the URL, provided it |
| 30 | * is valid (e.g. a URL is specified, or an environment variable is given and exists). |
| 31 | * - If neither of the above conditions is met, the default data is returned. |
| 32 | * |
| 33 | * Summarizing the above, the prioritization hierarchy is `setChain` -> `foundry.toml` -> environment variable -> defaults. |
| 34 | */ |
| 35 | abstract contract StdChains { |
| 36 | VmSafe private constant vm = VmSafe(address(uint160(uint256(keccak256("hevm cheat code"))))); |
| 37 | |
| 38 | bool private stdChainsInitialized; |
| 39 | |
| 40 | struct ChainData { |
| 41 | string name; |
| 42 | uint256 chainId; |
| 43 | string rpcUrl; |
| 44 | } |
| 45 | |
| 46 | struct Chain { |
| 47 | // The chain name. |
| 48 | string name; |
| 49 | // The chain's Chain ID. |
| 50 | uint256 chainId; |
| 51 | // The chain's alias. (i.e. what gets specified in `foundry.toml`). |
| 52 | string chainAlias; |
| 53 | // A default RPC endpoint for this chain. |
| 54 | // NOTE: This default RPC URL is included for convenience to facilitate quick tests and |
| 55 | // experimentation. Do not use this RPC URL for production test suites, CI, or other heavy |
| 56 | // usage as you will be throttled and this is a disservice to others who need this endpoint. |
| 57 | string rpcUrl; |
| 58 | } |
| 59 | |
| 60 | // Maps from the chain's alias (matching the alias in the `foundry.toml` file) to chain data. |
| 61 | mapping(string => Chain) private chains; |
| 62 | // Maps from the chain's alias to it's default RPC URL. |
| 63 | mapping(string => string) private defaultRpcUrls; |
| 64 | // Maps from a chain ID to it's alias. |
| 65 | mapping(uint256 => string) private idToAlias; |
| 66 | |
| 67 | bool private fallbackToDefaultRpcUrls = true; |
| 68 | |
| 69 | // The RPC URL will be fetched from config or defaultRpcUrls if possible. |
| 70 | function getChain(string memory chainAlias) internal virtual returns (Chain memory chain) { |
| 71 | require(bytes(chainAlias).length != 0, "StdChains getChain(string): Chain alias cannot be the empty string."); |
| 72 | |
| 73 | initializeStdChains(); |
| 74 | chain = chains[chainAlias]; |
| 75 | require( |
| 76 | chain.chainId != 0, |
| 77 | string(abi.encodePacked("StdChains getChain(string): Chain with alias \"", chainAlias, "\" not found.")) |
| 78 | ); |
| 79 | |
| 80 | chain = getChainWithUpdatedRpcUrl(chainAlias, chain); |
| 81 | } |
| 82 | |
| 83 | function getChain(uint256 chainId) internal virtual returns (Chain memory chain) { |
| 84 | require(chainId != 0, "StdChains getChain(uint256): Chain ID cannot be 0."); |
| 85 | initializeStdChains(); |
| 86 | string memory chainAlias = idToAlias[chainId]; |
| 87 | |
| 88 | chain = chains[chainAlias]; |
| 89 | |
| 90 | require( |
| 91 | chain.chainId != 0, |
| 92 | string(abi.encodePacked("StdChains getChain(uint256): Chain with ID ", vm.toString(chainId), " not found.")) |
| 93 | ); |
| 94 | |
| 95 | chain = getChainWithUpdatedRpcUrl(chainAlias, chain); |
| 96 | } |
| 97 | |
| 98 | // set chain info, with priority to argument's rpcUrl field. |
| 99 | function setChain(string memory chainAlias, ChainData memory chain) internal virtual { |
| 100 | require( |
| 101 | bytes(chainAlias).length != 0, |
| 102 | "StdChains setChain(string,ChainData): Chain alias cannot be the empty string." |
| 103 | ); |
| 104 | |
| 105 | require(chain.chainId != 0, "StdChains setChain(string,ChainData): Chain ID cannot be 0."); |
| 106 | |
| 107 | initializeStdChains(); |
| 108 | string memory foundAlias = idToAlias[chain.chainId]; |
| 109 | |
| 110 | require( |
| 111 | bytes(foundAlias).length == 0 || keccak256(bytes(foundAlias)) == keccak256(bytes(chainAlias)), |
| 112 | string( |
| 113 | abi.encodePacked( |
| 114 | "StdChains setChain(string,ChainData): Chain ID ", |
| 115 | vm.toString(chain.chainId), |
| 116 | " already used by \"", |
| 117 | foundAlias, |
| 118 | "\"." |
| 119 | ) |
| 120 | ) |
| 121 | ); |
| 122 | |
| 123 | uint256 oldChainId = chains[chainAlias].chainId; |
| 124 | delete idToAlias[oldChainId]; |
| 125 | |
| 126 | chains[chainAlias] = |
| 127 | Chain({name: chain.name, chainId: chain.chainId, chainAlias: chainAlias, rpcUrl: chain.rpcUrl}); |
| 128 | idToAlias[chain.chainId] = chainAlias; |
| 129 | } |
| 130 | |
| 131 | // set chain info, with priority to argument's rpcUrl field. |
| 132 | function setChain(string memory chainAlias, Chain memory chain) internal virtual { |
| 133 | setChain(chainAlias, ChainData({name: chain.name, chainId: chain.chainId, rpcUrl: chain.rpcUrl})); |
| 134 | } |
| 135 | |
| 136 | function _toUpper(string memory str) private pure returns (string memory) { |
| 137 | bytes memory strb = bytes(str); |
| 138 | bytes memory copy = new bytes(strb.length); |
| 139 | for (uint256 i = 0; i < strb.length; i++) { |
| 140 | bytes1 b = strb[i]; |
| 141 | if (b >= 0x61 && b <= 0x7A) { |
| 142 | copy[i] = bytes1(uint8(b) - 32); |
| 143 | } else { |
| 144 | copy[i] = b; |
| 145 | } |
| 146 | } |
| 147 | return string(copy); |
| 148 | } |
| 149 | |
| 150 | // lookup rpcUrl, in descending order of priority: |
| 151 | // current -> config (foundry.toml) -> environment variable -> default |
| 152 | function getChainWithUpdatedRpcUrl(string memory chainAlias, Chain memory chain) |
| 153 | private |
| 154 | view |
| 155 | returns (Chain memory) |
| 156 | { |
| 157 | if (bytes(chain.rpcUrl).length == 0) { |
| 158 | try vm.rpcUrl(chainAlias) returns (string memory configRpcUrl) { |
| 159 | chain.rpcUrl = configRpcUrl; |
| 160 | } catch (bytes memory err) { |
| 161 | string memory envName = string(abi.encodePacked(_toUpper(chainAlias), "_RPC_URL")); |
| 162 | if (fallbackToDefaultRpcUrls) { |
| 163 | chain.rpcUrl = vm.envOr(envName, defaultRpcUrls[chainAlias]); |
| 164 | } else { |
| 165 | chain.rpcUrl = vm.envString(envName); |
| 166 | } |
| 167 | // Distinguish 'not found' from 'cannot read' |
| 168 | // The upstream error thrown by forge for failing cheats changed so we check both the old and new versions |
| 169 | bytes memory oldNotFoundError = |
| 170 | abi.encodeWithSignature("CheatCodeError", string(abi.encodePacked("invalid rpc url ", chainAlias))); |
| 171 | bytes memory newNotFoundError = abi.encodeWithSignature( |
| 172 | "CheatcodeError(string)", string(abi.encodePacked("invalid rpc url: ", chainAlias)) |
| 173 | ); |
| 174 | bytes32 errHash = keccak256(err); |
| 175 | if ( |
| 176 | (errHash != keccak256(oldNotFoundError) && errHash != keccak256(newNotFoundError)) |
| 177 | || bytes(chain.rpcUrl).length == 0 |
| 178 | ) { |
| 179 | /// @solidity memory-safe-assembly |
| 180 | assembly { |
| 181 | revert(add(32, err), mload(err)) |
| 182 | } |
| 183 | } |
| 184 | } |
| 185 | } |
| 186 | return chain; |
| 187 | } |
| 188 | |
| 189 | function setFallbackToDefaultRpcUrls(bool useDefault) internal { |
| 190 | fallbackToDefaultRpcUrls = useDefault; |
| 191 | } |
| 192 | |
| 193 | function initializeStdChains() private { |
| 194 | if (stdChainsInitialized) return; |
| 195 | |
| 196 | stdChainsInitialized = true; |
| 197 | |
| 198 | // If adding an RPC here, make sure to test the default RPC URL in `test_Rpcs` in `StdChains.t.sol` |
| 199 | setChainWithDefaultRpcUrl("anvil", ChainData("Anvil", 31337, "http://127.0.0.1:8545")); |
| 200 | setChainWithDefaultRpcUrl("mainnet", ChainData("Mainnet", 1, "https://eth.llamarpc.com")); |
| 201 | setChainWithDefaultRpcUrl( |
| 202 | "sepolia", ChainData("Sepolia", 11155111, "https://sepolia.infura.io/v3/b9794ad1ddf84dfb8c34d6bb5dca2001") |
| 203 | ); |
| 204 | setChainWithDefaultRpcUrl("holesky", ChainData("Holesky", 17000, "https://rpc.holesky.ethpandaops.io")); |
| 205 | setChainWithDefaultRpcUrl("hoodi", ChainData("Hoodi", 560048, "https://rpc.hoodi.ethpandaops.io")); |
| 206 | setChainWithDefaultRpcUrl("optimism", ChainData("Optimism", 10, "https://mainnet.optimism.io")); |
| 207 | setChainWithDefaultRpcUrl( |
| 208 | "optimism_sepolia", ChainData("Optimism Sepolia", 11155420, "https://sepolia.optimism.io") |
| 209 | ); |
| 210 | setChainWithDefaultRpcUrl("arbitrum_one", ChainData("Arbitrum One", 42161, "https://arb1.arbitrum.io/rpc")); |
| 211 | setChainWithDefaultRpcUrl( |
| 212 | "arbitrum_one_sepolia", ChainData("Arbitrum One Sepolia", 421614, "https://sepolia-rollup.arbitrum.io/rpc") |
| 213 | ); |
| 214 | setChainWithDefaultRpcUrl("arbitrum_nova", ChainData("Arbitrum Nova", 42170, "https://nova.arbitrum.io/rpc")); |
| 215 | setChainWithDefaultRpcUrl("polygon", ChainData("Polygon", 137, "https://polygon-rpc.com")); |
| 216 | setChainWithDefaultRpcUrl( |
| 217 | "polygon_amoy", ChainData("Polygon Amoy", 80002, "https://rpc-amoy.polygon.technology") |
| 218 | ); |
| 219 | setChainWithDefaultRpcUrl("avalanche", ChainData("Avalanche", 43114, "https://api.avax.network/ext/bc/C/rpc")); |
| 220 | setChainWithDefaultRpcUrl( |
| 221 | "avalanche_fuji", ChainData("Avalanche Fuji", 43113, "https://api.avax-test.network/ext/bc/C/rpc") |
| 222 | ); |
| 223 | setChainWithDefaultRpcUrl( |
| 224 | "bnb_smart_chain", ChainData("BNB Smart Chain", 56, "https://bsc-dataseed1.binance.org") |
| 225 | ); |
| 226 | setChainWithDefaultRpcUrl( |
| 227 | "bnb_smart_chain_testnet", |
| 228 | ChainData("BNB Smart Chain Testnet", 97, "https://rpc.ankr.com/bsc_testnet_chapel") |
| 229 | ); |
| 230 | setChainWithDefaultRpcUrl("gnosis_chain", ChainData("Gnosis Chain", 100, "https://rpc.gnosischain.com")); |
| 231 | setChainWithDefaultRpcUrl("moonbeam", ChainData("Moonbeam", 1284, "https://rpc.api.moonbeam.network")); |
| 232 | setChainWithDefaultRpcUrl( |
| 233 | "moonriver", ChainData("Moonriver", 1285, "https://rpc.api.moonriver.moonbeam.network") |
| 234 | ); |
| 235 | setChainWithDefaultRpcUrl("moonbase", ChainData("Moonbase", 1287, "https://rpc.testnet.moonbeam.network")); |
| 236 | setChainWithDefaultRpcUrl("base_sepolia", ChainData("Base Sepolia", 84532, "https://sepolia.base.org")); |
| 237 | setChainWithDefaultRpcUrl("base", ChainData("Base", 8453, "https://mainnet.base.org")); |
| 238 | setChainWithDefaultRpcUrl("blast_sepolia", ChainData("Blast Sepolia", 168587773, "https://sepolia.blast.io")); |
| 239 | setChainWithDefaultRpcUrl("blast", ChainData("Blast", 81457, "https://rpc.blast.io")); |
| 240 | setChainWithDefaultRpcUrl("fantom_opera", ChainData("Fantom Opera", 250, "https://rpc.ankr.com/fantom/")); |
| 241 | setChainWithDefaultRpcUrl( |
| 242 | "fantom_opera_testnet", ChainData("Fantom Opera Testnet", 4002, "https://rpc.ankr.com/fantom_testnet/") |
| 243 | ); |
| 244 | setChainWithDefaultRpcUrl("fraxtal", ChainData("Fraxtal", 252, "https://rpc.frax.com")); |
| 245 | setChainWithDefaultRpcUrl("fraxtal_testnet", ChainData("Fraxtal Testnet", 2522, "https://rpc.testnet.frax.com")); |
| 246 | setChainWithDefaultRpcUrl( |
| 247 | "berachain_bartio_testnet", ChainData("Berachain bArtio Testnet", 80084, "https://bartio.rpc.berachain.com") |
| 248 | ); |
| 249 | setChainWithDefaultRpcUrl("flare", ChainData("Flare", 14, "https://flare-api.flare.network/ext/C/rpc")); |
| 250 | setChainWithDefaultRpcUrl( |
| 251 | "flare_coston2", ChainData("Flare Coston2", 114, "https://coston2-api.flare.network/ext/C/rpc") |
| 252 | ); |
| 253 | |
| 254 | setChainWithDefaultRpcUrl("ink", ChainData("Ink", 57073, "https://rpc-gel.inkonchain.com")); |
| 255 | setChainWithDefaultRpcUrl( |
| 256 | "ink_sepolia", ChainData("Ink Sepolia", 763373, "https://rpc-gel-sepolia.inkonchain.com") |
| 257 | ); |
| 258 | |
| 259 | setChainWithDefaultRpcUrl("mode", ChainData("Mode", 34443, "https://mode.drpc.org")); |
| 260 | setChainWithDefaultRpcUrl("mode_sepolia", ChainData("Mode Sepolia", 919, "https://sepolia.mode.network")); |
| 261 | |
| 262 | setChainWithDefaultRpcUrl("zora", ChainData("Zora", 7777777, "https://zora.drpc.org")); |
| 263 | setChainWithDefaultRpcUrl( |
| 264 | "zora_sepolia", ChainData("Zora Sepolia", 999999999, "https://sepolia.rpc.zora.energy") |
| 265 | ); |
| 266 | |
| 267 | setChainWithDefaultRpcUrl("race", ChainData("Race", 6805, "https://racemainnet.io")); |
| 268 | setChainWithDefaultRpcUrl("race_sepolia", ChainData("Race Sepolia", 6806, "https://racemainnet.io")); |
| 269 | |
| 270 | setChainWithDefaultRpcUrl("metal", ChainData("Metal", 1750, "https://metall2.drpc.org")); |
| 271 | setChainWithDefaultRpcUrl("metal_sepolia", ChainData("Metal Sepolia", 1740, "https://testnet.rpc.metall2.com")); |
| 272 | |
| 273 | setChainWithDefaultRpcUrl("binary", ChainData("Binary", 624, "https://rpc.zero.thebinaryholdings.com")); |
| 274 | setChainWithDefaultRpcUrl( |
| 275 | "binary_sepolia", ChainData("Binary Sepolia", 625, "https://rpc.zero.thebinaryholdings.com") |
| 276 | ); |
| 277 | |
| 278 | setChainWithDefaultRpcUrl("orderly", ChainData("Orderly", 291, "https://rpc.orderly.network")); |
| 279 | setChainWithDefaultRpcUrl( |
| 280 | "orderly_sepolia", ChainData("Orderly Sepolia", 4460, "https://testnet-rpc.orderly.org") |
| 281 | ); |
| 282 | |
| 283 | setChainWithDefaultRpcUrl("unichain", ChainData("Unichain", 130, "https://mainnet.unichain.org")); |
| 284 | setChainWithDefaultRpcUrl( |
| 285 | "unichain_sepolia", ChainData("Unichain Sepolia", 1301, "https://sepolia.unichain.org") |
| 286 | ); |
| 287 | } |
| 288 | |
| 289 | // set chain info, with priority to chainAlias' rpc url in foundry.toml |
| 290 | function setChainWithDefaultRpcUrl(string memory chainAlias, ChainData memory chain) private { |
| 291 | string memory rpcUrl = chain.rpcUrl; |
| 292 | defaultRpcUrls[chainAlias] = rpcUrl; |
| 293 | chain.rpcUrl = ""; |
| 294 | setChain(chainAlias, chain); |
| 295 | chain.rpcUrl = rpcUrl; // restore argument |
| 296 | } |
| 297 | } |
| 298 |
0.0%
lib/forge-std/src/StdCheats.sol
Lines covered: 0 / 0 (0.0%)
| 1 | // SPDX-License-Identifier: MIT |
| 2 | pragma solidity >=0.6.2 <0.9.0; |
| 3 | |
| 4 | pragma experimental ABIEncoderV2; |
| 5 | |
| 6 | import {StdStorage, stdStorage} from "./StdStorage.sol"; |
| 7 | import {console2} from "./console2.sol"; |
| 8 | import {Vm} from "./Vm.sol"; |
| 9 | |
| 10 | abstract contract StdCheatsSafe { |
| 11 | Vm private constant vm = Vm(address(uint160(uint256(keccak256("hevm cheat code"))))); |
| 12 | |
| 13 | uint256 private constant UINT256_MAX = |
| 14 | 115792089237316195423570985008687907853269984665640564039457584007913129639935; |
| 15 | |
| 16 | bool private gasMeteringOff; |
| 17 | |
| 18 | // Data structures to parse Transaction objects from the broadcast artifact |
| 19 | // that conform to EIP1559. The Raw structs is what is parsed from the JSON |
| 20 | // and then converted to the one that is used by the user for better UX. |
| 21 | |
| 22 | struct RawTx1559 { |
| 23 | string[] arguments; |
| 24 | address contractAddress; |
| 25 | string contractName; |
| 26 | // json value name = function |
| 27 | string functionSig; |
| 28 | bytes32 hash; |
| 29 | // json value name = tx |
| 30 | RawTx1559Detail txDetail; |
| 31 | // json value name = type |
| 32 | string opcode; |
| 33 | } |
| 34 | |
| 35 | struct RawTx1559Detail { |
| 36 | AccessList[] accessList; |
| 37 | bytes data; |
| 38 | address from; |
| 39 | bytes gas; |
| 40 | bytes nonce; |
| 41 | address to; |
| 42 | bytes txType; |
| 43 | bytes value; |
| 44 | } |
| 45 | |
| 46 | struct Tx1559 { |
| 47 | string[] arguments; |
| 48 | address contractAddress; |
| 49 | string contractName; |
| 50 | string functionSig; |
| 51 | bytes32 hash; |
| 52 | Tx1559Detail txDetail; |
| 53 | string opcode; |
| 54 | } |
| 55 | |
| 56 | struct Tx1559Detail { |
| 57 | AccessList[] accessList; |
| 58 | bytes data; |
| 59 | address from; |
| 60 | uint256 gas; |
| 61 | uint256 nonce; |
| 62 | address to; |
| 63 | uint256 txType; |
| 64 | uint256 value; |
| 65 | } |
| 66 | |
| 67 | // Data structures to parse Transaction objects from the broadcast artifact |
| 68 | // that DO NOT conform to EIP1559. The Raw structs is what is parsed from the JSON |
| 69 | // and then converted to the one that is used by the user for better UX. |
| 70 | |
| 71 | struct TxLegacy { |
| 72 | string[] arguments; |
| 73 | address contractAddress; |
| 74 | string contractName; |
| 75 | string functionSig; |
| 76 | string hash; |
| 77 | string opcode; |
| 78 | TxDetailLegacy transaction; |
| 79 | } |
| 80 | |
| 81 | struct TxDetailLegacy { |
| 82 | AccessList[] accessList; |
| 83 | uint256 chainId; |
| 84 | bytes data; |
| 85 | address from; |
| 86 | uint256 gas; |
| 87 | uint256 gasPrice; |
| 88 | bytes32 hash; |
| 89 | uint256 nonce; |
| 90 | bytes1 opcode; |
| 91 | bytes32 r; |
| 92 | bytes32 s; |
| 93 | uint256 txType; |
| 94 | address to; |
| 95 | uint8 v; |
| 96 | uint256 value; |
| 97 | } |
| 98 | |
| 99 | struct AccessList { |
| 100 | address accessAddress; |
| 101 | bytes32[] storageKeys; |
| 102 | } |
| 103 | |
| 104 | // Data structures to parse Receipt objects from the broadcast artifact. |
| 105 | // The Raw structs is what is parsed from the JSON |
| 106 | // and then converted to the one that is used by the user for better UX. |
| 107 | |
| 108 | struct RawReceipt { |
| 109 | bytes32 blockHash; |
| 110 | bytes blockNumber; |
| 111 | address contractAddress; |
| 112 | bytes cumulativeGasUsed; |
| 113 | bytes effectiveGasPrice; |
| 114 | address from; |
| 115 | bytes gasUsed; |
| 116 | RawReceiptLog[] logs; |
| 117 | bytes logsBloom; |
| 118 | bytes status; |
| 119 | address to; |
| 120 | bytes32 transactionHash; |
| 121 | bytes transactionIndex; |
| 122 | } |
| 123 | |
| 124 | struct Receipt { |
| 125 | bytes32 blockHash; |
| 126 | uint256 blockNumber; |
| 127 | address contractAddress; |
| 128 | uint256 cumulativeGasUsed; |
| 129 | uint256 effectiveGasPrice; |
| 130 | address from; |
| 131 | uint256 gasUsed; |
| 132 | ReceiptLog[] logs; |
| 133 | bytes logsBloom; |
| 134 | uint256 status; |
| 135 | address to; |
| 136 | bytes32 transactionHash; |
| 137 | uint256 transactionIndex; |
| 138 | } |
| 139 | |
| 140 | // Data structures to parse the entire broadcast artifact, assuming the |
| 141 | // transactions conform to EIP1559. |
| 142 | |
| 143 | struct EIP1559ScriptArtifact { |
| 144 | string[] libraries; |
| 145 | string path; |
| 146 | string[] pending; |
| 147 | Receipt[] receipts; |
| 148 | uint256 timestamp; |
| 149 | Tx1559[] transactions; |
| 150 | TxReturn[] txReturns; |
| 151 | } |
| 152 | |
| 153 | struct RawEIP1559ScriptArtifact { |
| 154 | string[] libraries; |
| 155 | string path; |
| 156 | string[] pending; |
| 157 | RawReceipt[] receipts; |
| 158 | TxReturn[] txReturns; |
| 159 | uint256 timestamp; |
| 160 | RawTx1559[] transactions; |
| 161 | } |
| 162 | |
| 163 | struct RawReceiptLog { |
| 164 | // json value = address |
| 165 | address logAddress; |
| 166 | bytes32 blockHash; |
| 167 | bytes blockNumber; |
| 168 | bytes data; |
| 169 | bytes logIndex; |
| 170 | bool removed; |
| 171 | bytes32[] topics; |
| 172 | bytes32 transactionHash; |
| 173 | bytes transactionIndex; |
| 174 | bytes transactionLogIndex; |
| 175 | } |
| 176 | |
| 177 | struct ReceiptLog { |
| 178 | // json value = address |
| 179 | address logAddress; |
| 180 | bytes32 blockHash; |
| 181 | uint256 blockNumber; |
| 182 | bytes data; |
| 183 | uint256 logIndex; |
| 184 | bytes32[] topics; |
| 185 | uint256 transactionIndex; |
| 186 | uint256 transactionLogIndex; |
| 187 | bool removed; |
| 188 | } |
| 189 | |
| 190 | struct TxReturn { |
| 191 | string internalType; |
| 192 | string value; |
| 193 | } |
| 194 | |
| 195 | struct Account { |
| 196 | address addr; |
| 197 | uint256 key; |
| 198 | } |
| 199 | |
| 200 | enum AddressType { |
| 201 | Payable, |
| 202 | NonPayable, |
| 203 | ZeroAddress, |
| 204 | Precompile, |
| 205 | ForgeAddress |
| 206 | } |
| 207 | |
| 208 | // Checks that `addr` is not blacklisted by token contracts that have a blacklist. |
| 209 | function assumeNotBlacklisted(address token, address addr) internal view virtual { |
| 210 | // Nothing to check if `token` is not a contract. |
| 211 | uint256 tokenCodeSize; |
| 212 | assembly { |
| 213 | tokenCodeSize := extcodesize(token) |
| 214 | } |
| 215 | require(tokenCodeSize > 0, "StdCheats assumeNotBlacklisted(address,address): Token address is not a contract."); |
| 216 | |
| 217 | bool success; |
| 218 | bytes memory returnData; |
| 219 | |
| 220 | // 4-byte selector for `isBlacklisted(address)`, used by USDC. |
| 221 | (success, returnData) = token.staticcall(abi.encodeWithSelector(0xfe575a87, addr)); |
| 222 | vm.assume(!success || abi.decode(returnData, (bool)) == false); |
| 223 | |
| 224 | // 4-byte selector for `isBlackListed(address)`, used by USDT. |
| 225 | (success, returnData) = token.staticcall(abi.encodeWithSelector(0xe47d6060, addr)); |
| 226 | vm.assume(!success || abi.decode(returnData, (bool)) == false); |
| 227 | } |
| 228 | |
| 229 | // Checks that `addr` is not blacklisted by token contracts that have a blacklist. |
| 230 | // This is identical to `assumeNotBlacklisted(address,address)` but with a different name, for |
| 231 | // backwards compatibility, since this name was used in the original PR which already has |
| 232 | // a release. This function can be removed in a future release once we want a breaking change. |
| 233 | function assumeNoBlacklisted(address token, address addr) internal view virtual { |
| 234 | assumeNotBlacklisted(token, addr); |
| 235 | } |
| 236 | |
| 237 | function assumeAddressIsNot(address addr, AddressType addressType) internal virtual { |
| 238 | if (addressType == AddressType.Payable) { |
| 239 | assumeNotPayable(addr); |
| 240 | } else if (addressType == AddressType.NonPayable) { |
| 241 | assumePayable(addr); |
| 242 | } else if (addressType == AddressType.ZeroAddress) { |
| 243 | assumeNotZeroAddress(addr); |
| 244 | } else if (addressType == AddressType.Precompile) { |
| 245 | assumeNotPrecompile(addr); |
| 246 | } else if (addressType == AddressType.ForgeAddress) { |
| 247 | assumeNotForgeAddress(addr); |
| 248 | } |
| 249 | } |
| 250 | |
| 251 | function assumeAddressIsNot(address addr, AddressType addressType1, AddressType addressType2) internal virtual { |
| 252 | assumeAddressIsNot(addr, addressType1); |
| 253 | assumeAddressIsNot(addr, addressType2); |
| 254 | } |
| 255 | |
| 256 | function assumeAddressIsNot( |
| 257 | address addr, |
| 258 | AddressType addressType1, |
| 259 | AddressType addressType2, |
| 260 | AddressType addressType3 |
| 261 | ) internal virtual { |
| 262 | assumeAddressIsNot(addr, addressType1); |
| 263 | assumeAddressIsNot(addr, addressType2); |
| 264 | assumeAddressIsNot(addr, addressType3); |
| 265 | } |
| 266 | |
| 267 | function assumeAddressIsNot( |
| 268 | address addr, |
| 269 | AddressType addressType1, |
| 270 | AddressType addressType2, |
| 271 | AddressType addressType3, |
| 272 | AddressType addressType4 |
| 273 | ) internal virtual { |
| 274 | assumeAddressIsNot(addr, addressType1); |
| 275 | assumeAddressIsNot(addr, addressType2); |
| 276 | assumeAddressIsNot(addr, addressType3); |
| 277 | assumeAddressIsNot(addr, addressType4); |
| 278 | } |
| 279 | |
| 280 | // This function checks whether an address, `addr`, is payable. It works by sending 1 wei to |
| 281 | // `addr` and checking the `success` return value. |
| 282 | // NOTE: This function may result in state changes depending on the fallback/receive logic |
| 283 | // implemented by `addr`, which should be taken into account when this function is used. |
| 284 | function _isPayable(address addr) private returns (bool) { |
| 285 | require( |
| 286 | addr.balance < UINT256_MAX, |
| 287 | "StdCheats _isPayable(address): Balance equals max uint256, so it cannot receive any more funds" |
| 288 | ); |
| 289 | uint256 origBalanceTest = address(this).balance; |
| 290 | uint256 origBalanceAddr = address(addr).balance; |
| 291 | |
| 292 | vm.deal(address(this), 1); |
| 293 | (bool success,) = payable(addr).call{value: 1}(""); |
| 294 | |
| 295 | // reset balances |
| 296 | vm.deal(address(this), origBalanceTest); |
| 297 | vm.deal(addr, origBalanceAddr); |
| 298 | |
| 299 | return success; |
| 300 | } |
| 301 | |
| 302 | // NOTE: This function may result in state changes depending on the fallback/receive logic |
| 303 | // implemented by `addr`, which should be taken into account when this function is used. See the |
| 304 | // `_isPayable` method for more information. |
| 305 | function assumePayable(address addr) internal virtual { |
| 306 | vm.assume(_isPayable(addr)); |
| 307 | } |
| 308 | |
| 309 | function assumeNotPayable(address addr) internal virtual { |
| 310 | vm.assume(!_isPayable(addr)); |
| 311 | } |
| 312 | |
| 313 | function assumeNotZeroAddress(address addr) internal pure virtual { |
| 314 | vm.assume(addr != address(0)); |
| 315 | } |
| 316 | |
| 317 | function assumeNotPrecompile(address addr) internal pure virtual { |
| 318 | assumeNotPrecompile(addr, _pureChainId()); |
| 319 | } |
| 320 | |
| 321 | function assumeNotPrecompile(address addr, uint256 chainId) internal pure virtual { |
| 322 | // Note: For some chains like Optimism these are technically predeploys (i.e. bytecode placed at a specific |
| 323 | // address), but the same rationale for excluding them applies so we include those too. |
| 324 | |
| 325 | // These are reserved by Ethereum and may be on all EVM-compatible chains. |
| 326 | vm.assume(addr < address(0x1) || addr > address(0xff)); |
| 327 | |
| 328 | // forgefmt: disable-start |
| 329 | if (chainId == 10 || chainId == 420 || chainId == 11155420) { |
| 330 | // https://github.com/ethereum-optimism/optimism/blob/eaa371a0184b56b7ca6d9eb9cb0a2b78b2ccd864/op-bindings/predeploys/addresses.go#L6-L21 |
| 331 | vm.assume(addr < address(0x4200000000000000000000000000000000000000) || addr > address(0x4200000000000000000000000000000000000800)); |
| 332 | } else if (chainId == 42161 || chainId == 421613) { |
| 333 | // https://developer.arbitrum.io/useful-addresses#arbitrum-precompiles-l2-same-on-all-arb-chains |
| 334 | vm.assume(addr < address(0x0000000000000000000000000000000000000064) || addr > address(0x0000000000000000000000000000000000000068)); |
| 335 | } else if (chainId == 43114 || chainId == 43113) { |
| 336 | // https://github.com/ava-labs/subnet-evm/blob/47c03fd007ecaa6de2c52ea081596e0a88401f58/precompile/params.go#L18-L59 |
| 337 | vm.assume(addr < address(0x0100000000000000000000000000000000000000) || addr > address(0x01000000000000000000000000000000000000ff)); |
| 338 | vm.assume(addr < address(0x0200000000000000000000000000000000000000) || addr > address(0x02000000000000000000000000000000000000FF)); |
| 339 | vm.assume(addr < address(0x0300000000000000000000000000000000000000) || addr > address(0x03000000000000000000000000000000000000Ff)); |
| 340 | } |
| 341 | // forgefmt: disable-end |
| 342 | } |
| 343 | |
| 344 | function assumeNotForgeAddress(address addr) internal pure virtual { |
| 345 | // vm, console, and Create2Deployer addresses |
| 346 | vm.assume( |
| 347 | addr != address(vm) && addr != 0x000000000000000000636F6e736F6c652e6c6f67 |
| 348 | && addr != 0x4e59b44847b379578588920cA78FbF26c0B4956C |
| 349 | ); |
| 350 | } |
| 351 | |
| 352 | function assumeUnusedAddress(address addr) internal view virtual { |
| 353 | uint256 size; |
| 354 | assembly { |
| 355 | size := extcodesize(addr) |
| 356 | } |
| 357 | vm.assume(size == 0); |
| 358 | |
| 359 | assumeNotPrecompile(addr); |
| 360 | assumeNotZeroAddress(addr); |
| 361 | assumeNotForgeAddress(addr); |
| 362 | } |
| 363 | |
| 364 | function readEIP1559ScriptArtifact(string memory path) |
| 365 | internal |
| 366 | view |
| 367 | virtual |
| 368 | returns (EIP1559ScriptArtifact memory) |
| 369 | { |
| 370 | string memory data = vm.readFile(path); |
| 371 | bytes memory parsedData = vm.parseJson(data); |
| 372 | RawEIP1559ScriptArtifact memory rawArtifact = abi.decode(parsedData, (RawEIP1559ScriptArtifact)); |
| 373 | EIP1559ScriptArtifact memory artifact; |
| 374 | artifact.libraries = rawArtifact.libraries; |
| 375 | artifact.path = rawArtifact.path; |
| 376 | artifact.timestamp = rawArtifact.timestamp; |
| 377 | artifact.pending = rawArtifact.pending; |
| 378 | artifact.txReturns = rawArtifact.txReturns; |
| 379 | artifact.receipts = rawToConvertedReceipts(rawArtifact.receipts); |
| 380 | artifact.transactions = rawToConvertedEIPTx1559s(rawArtifact.transactions); |
| 381 | return artifact; |
| 382 | } |
| 383 | |
| 384 | function rawToConvertedEIPTx1559s(RawTx1559[] memory rawTxs) internal pure virtual returns (Tx1559[] memory) { |
| 385 | Tx1559[] memory txs = new Tx1559[](rawTxs.length); |
| 386 | for (uint256 i; i < rawTxs.length; i++) { |
| 387 | txs[i] = rawToConvertedEIPTx1559(rawTxs[i]); |
| 388 | } |
| 389 | return txs; |
| 390 | } |
| 391 | |
| 392 | function rawToConvertedEIPTx1559(RawTx1559 memory rawTx) internal pure virtual returns (Tx1559 memory) { |
| 393 | Tx1559 memory transaction; |
| 394 | transaction.arguments = rawTx.arguments; |
| 395 | transaction.contractName = rawTx.contractName; |
| 396 | transaction.functionSig = rawTx.functionSig; |
| 397 | transaction.hash = rawTx.hash; |
| 398 | transaction.txDetail = rawToConvertedEIP1559Detail(rawTx.txDetail); |
| 399 | transaction.opcode = rawTx.opcode; |
| 400 | return transaction; |
| 401 | } |
| 402 | |
| 403 | function rawToConvertedEIP1559Detail(RawTx1559Detail memory rawDetail) |
| 404 | internal |
| 405 | pure |
| 406 | virtual |
| 407 | returns (Tx1559Detail memory) |
| 408 | { |
| 409 | Tx1559Detail memory txDetail; |
| 410 | txDetail.data = rawDetail.data; |
| 411 | txDetail.from = rawDetail.from; |
| 412 | txDetail.to = rawDetail.to; |
| 413 | txDetail.nonce = _bytesToUint(rawDetail.nonce); |
| 414 | txDetail.txType = _bytesToUint(rawDetail.txType); |
| 415 | txDetail.value = _bytesToUint(rawDetail.value); |
| 416 | txDetail.gas = _bytesToUint(rawDetail.gas); |
| 417 | txDetail.accessList = rawDetail.accessList; |
| 418 | return txDetail; |
| 419 | } |
| 420 | |
| 421 | function readTx1559s(string memory path) internal view virtual returns (Tx1559[] memory) { |
| 422 | string memory deployData = vm.readFile(path); |
| 423 | bytes memory parsedDeployData = vm.parseJson(deployData, ".transactions"); |
| 424 | RawTx1559[] memory rawTxs = abi.decode(parsedDeployData, (RawTx1559[])); |
| 425 | return rawToConvertedEIPTx1559s(rawTxs); |
| 426 | } |
| 427 | |
| 428 | function readTx1559(string memory path, uint256 index) internal view virtual returns (Tx1559 memory) { |
| 429 | string memory deployData = vm.readFile(path); |
| 430 | string memory key = string(abi.encodePacked(".transactions[", vm.toString(index), "]")); |
| 431 | bytes memory parsedDeployData = vm.parseJson(deployData, key); |
| 432 | RawTx1559 memory rawTx = abi.decode(parsedDeployData, (RawTx1559)); |
| 433 | return rawToConvertedEIPTx1559(rawTx); |
| 434 | } |
| 435 | |
| 436 | // Analogous to readTransactions, but for receipts. |
| 437 | function readReceipts(string memory path) internal view virtual returns (Receipt[] memory) { |
| 438 | string memory deployData = vm.readFile(path); |
| 439 | bytes memory parsedDeployData = vm.parseJson(deployData, ".receipts"); |
| 440 | RawReceipt[] memory rawReceipts = abi.decode(parsedDeployData, (RawReceipt[])); |
| 441 | return rawToConvertedReceipts(rawReceipts); |
| 442 | } |
| 443 | |
| 444 | function readReceipt(string memory path, uint256 index) internal view virtual returns (Receipt memory) { |
| 445 | string memory deployData = vm.readFile(path); |
| 446 | string memory key = string(abi.encodePacked(".receipts[", vm.toString(index), "]")); |
| 447 | bytes memory parsedDeployData = vm.parseJson(deployData, key); |
| 448 | RawReceipt memory rawReceipt = abi.decode(parsedDeployData, (RawReceipt)); |
| 449 | return rawToConvertedReceipt(rawReceipt); |
| 450 | } |
| 451 | |
| 452 | function rawToConvertedReceipts(RawReceipt[] memory rawReceipts) internal pure virtual returns (Receipt[] memory) { |
| 453 | Receipt[] memory receipts = new Receipt[](rawReceipts.length); |
| 454 | for (uint256 i; i < rawReceipts.length; i++) { |
| 455 | receipts[i] = rawToConvertedReceipt(rawReceipts[i]); |
| 456 | } |
| 457 | return receipts; |
| 458 | } |
| 459 | |
| 460 | function rawToConvertedReceipt(RawReceipt memory rawReceipt) internal pure virtual returns (Receipt memory) { |
| 461 | Receipt memory receipt; |
| 462 | receipt.blockHash = rawReceipt.blockHash; |
| 463 | receipt.to = rawReceipt.to; |
| 464 | receipt.from = rawReceipt.from; |
| 465 | receipt.contractAddress = rawReceipt.contractAddress; |
| 466 | receipt.effectiveGasPrice = _bytesToUint(rawReceipt.effectiveGasPrice); |
| 467 | receipt.cumulativeGasUsed = _bytesToUint(rawReceipt.cumulativeGasUsed); |
| 468 | receipt.gasUsed = _bytesToUint(rawReceipt.gasUsed); |
| 469 | receipt.status = _bytesToUint(rawReceipt.status); |
| 470 | receipt.transactionIndex = _bytesToUint(rawReceipt.transactionIndex); |
| 471 | receipt.blockNumber = _bytesToUint(rawReceipt.blockNumber); |
| 472 | receipt.logs = rawToConvertedReceiptLogs(rawReceipt.logs); |
| 473 | receipt.logsBloom = rawReceipt.logsBloom; |
| 474 | receipt.transactionHash = rawReceipt.transactionHash; |
| 475 | return receipt; |
| 476 | } |
| 477 | |
| 478 | function rawToConvertedReceiptLogs(RawReceiptLog[] memory rawLogs) |
| 479 | internal |
| 480 | pure |
| 481 | virtual |
| 482 | returns (ReceiptLog[] memory) |
| 483 | { |
| 484 | ReceiptLog[] memory logs = new ReceiptLog[](rawLogs.length); |
| 485 | for (uint256 i; i < rawLogs.length; i++) { |
| 486 | logs[i].logAddress = rawLogs[i].logAddress; |
| 487 | logs[i].blockHash = rawLogs[i].blockHash; |
| 488 | logs[i].blockNumber = _bytesToUint(rawLogs[i].blockNumber); |
| 489 | logs[i].data = rawLogs[i].data; |
| 490 | logs[i].logIndex = _bytesToUint(rawLogs[i].logIndex); |
| 491 | logs[i].topics = rawLogs[i].topics; |
| 492 | logs[i].transactionIndex = _bytesToUint(rawLogs[i].transactionIndex); |
| 493 | logs[i].transactionLogIndex = _bytesToUint(rawLogs[i].transactionLogIndex); |
| 494 | logs[i].removed = rawLogs[i].removed; |
| 495 | } |
| 496 | return logs; |
| 497 | } |
| 498 | |
| 499 | // Deploy a contract by fetching the contract bytecode from |
| 500 | // the artifacts directory |
| 501 | // e.g. `deployCode(code, abi.encode(arg1,arg2,arg3))` |
| 502 | function deployCode(string memory what, bytes memory args) internal virtual returns (address addr) { |
| 503 | bytes memory bytecode = abi.encodePacked(vm.getCode(what), args); |
| 504 | /// @solidity memory-safe-assembly |
| 505 | assembly { |
| 506 | addr := create(0, add(bytecode, 0x20), mload(bytecode)) |
| 507 | } |
| 508 | |
| 509 | require(addr != address(0), "StdCheats deployCode(string,bytes): Deployment failed."); |
| 510 | } |
| 511 | |
| 512 | function deployCode(string memory what) internal virtual returns (address addr) { |
| 513 | bytes memory bytecode = vm.getCode(what); |
| 514 | /// @solidity memory-safe-assembly |
| 515 | assembly { |
| 516 | addr := create(0, add(bytecode, 0x20), mload(bytecode)) |
| 517 | } |
| 518 | |
| 519 | require(addr != address(0), "StdCheats deployCode(string): Deployment failed."); |
| 520 | } |
| 521 | |
| 522 | /// @dev deploy contract with value on construction |
| 523 | function deployCode(string memory what, bytes memory args, uint256 val) internal virtual returns (address addr) { |
| 524 | bytes memory bytecode = abi.encodePacked(vm.getCode(what), args); |
| 525 | /// @solidity memory-safe-assembly |
| 526 | assembly { |
| 527 | addr := create(val, add(bytecode, 0x20), mload(bytecode)) |
| 528 | } |
| 529 | |
| 530 | require(addr != address(0), "StdCheats deployCode(string,bytes,uint256): Deployment failed."); |
| 531 | } |
| 532 | |
| 533 | function deployCode(string memory what, uint256 val) internal virtual returns (address addr) { |
| 534 | bytes memory bytecode = vm.getCode(what); |
| 535 | /// @solidity memory-safe-assembly |
| 536 | assembly { |
| 537 | addr := create(val, add(bytecode, 0x20), mload(bytecode)) |
| 538 | } |
| 539 | |
| 540 | require(addr != address(0), "StdCheats deployCode(string,uint256): Deployment failed."); |
| 541 | } |
| 542 | |
| 543 | // creates a labeled address and the corresponding private key |
| 544 | function makeAddrAndKey(string memory name) internal virtual returns (address addr, uint256 privateKey) { |
| 545 | privateKey = uint256(keccak256(abi.encodePacked(name))); |
| 546 | addr = vm.addr(privateKey); |
| 547 | vm.label(addr, name); |
| 548 | } |
| 549 | |
| 550 | // creates a labeled address |
| 551 | function makeAddr(string memory name) internal virtual returns (address addr) { |
| 552 | (addr,) = makeAddrAndKey(name); |
| 553 | } |
| 554 | |
| 555 | // Destroys an account immediately, sending the balance to beneficiary. |
| 556 | // Destroying means: balance will be zero, code will be empty, and nonce will be 0 |
| 557 | // This is similar to selfdestruct but not identical: selfdestruct destroys code and nonce |
| 558 | // only after tx ends, this will run immediately. |
| 559 | function destroyAccount(address who, address beneficiary) internal virtual { |
| 560 | uint256 currBalance = who.balance; |
| 561 | vm.etch(who, abi.encode()); |
| 562 | vm.deal(who, 0); |
| 563 | vm.resetNonce(who); |
| 564 | |
| 565 | uint256 beneficiaryBalance = beneficiary.balance; |
| 566 | vm.deal(beneficiary, currBalance + beneficiaryBalance); |
| 567 | } |
| 568 | |
| 569 | // creates a struct containing both a labeled address and the corresponding private key |
| 570 | function makeAccount(string memory name) internal virtual returns (Account memory account) { |
| 571 | (account.addr, account.key) = makeAddrAndKey(name); |
| 572 | } |
| 573 | |
| 574 | function deriveRememberKey(string memory mnemonic, uint32 index) |
| 575 | internal |
| 576 | virtual |
| 577 | returns (address who, uint256 privateKey) |
| 578 | { |
| 579 | privateKey = vm.deriveKey(mnemonic, index); |
| 580 | who = vm.rememberKey(privateKey); |
| 581 | } |
| 582 | |
| 583 | function _bytesToUint(bytes memory b) private pure returns (uint256) { |
| 584 | require(b.length <= 32, "StdCheats _bytesToUint(bytes): Bytes length exceeds 32."); |
| 585 | return abi.decode(abi.encodePacked(new bytes(32 - b.length), b), (uint256)); |
| 586 | } |
| 587 | |
| 588 | function isFork() internal view virtual returns (bool status) { |
| 589 | try vm.activeFork() { |
| 590 | status = true; |
| 591 | } catch (bytes memory) {} |
| 592 | } |
| 593 | |
| 594 | modifier skipWhenForking() { |
| 595 | if (!isFork()) { |
| 596 | _; |
| 597 | } |
| 598 | } |
| 599 | |
| 600 | modifier skipWhenNotForking() { |
| 601 | if (isFork()) { |
| 602 | _; |
| 603 | } |
| 604 | } |
| 605 | |
| 606 | modifier noGasMetering() { |
| 607 | vm.pauseGasMetering(); |
| 608 | // To prevent turning gas monitoring back on with nested functions that use this modifier, |
| 609 | // we check if gasMetering started in the off position. If it did, we don't want to turn |
| 610 | // it back on until we exit the top level function that used the modifier |
| 611 | // |
| 612 | // i.e. funcA() noGasMetering { funcB() }, where funcB has noGasMetering as well. |
| 613 | // funcA will have `gasStartedOff` as false, funcB will have it as true, |
| 614 | // so we only turn metering back on at the end of the funcA |
| 615 | bool gasStartedOff = gasMeteringOff; |
| 616 | gasMeteringOff = true; |
| 617 | |
| 618 | _; |
| 619 | |
| 620 | // if gas metering was on when this modifier was called, turn it back on at the end |
| 621 | if (!gasStartedOff) { |
| 622 | gasMeteringOff = false; |
| 623 | vm.resumeGasMetering(); |
| 624 | } |
| 625 | } |
| 626 | |
| 627 | // We use this complex approach of `_viewChainId` and `_pureChainId` to ensure there are no |
| 628 | // compiler warnings when accessing chain ID in any solidity version supported by forge-std. We |
| 629 | // can't simply access the chain ID in a normal view or pure function because the solc View Pure |
| 630 | // Checker changed `chainid` from pure to view in 0.8.0. |
| 631 | function _viewChainId() private view returns (uint256 chainId) { |
| 632 | // Assembly required since `block.chainid` was introduced in 0.8.0. |
| 633 | assembly { |
| 634 | chainId := chainid() |
| 635 | } |
| 636 | |
| 637 | address(this); // Silence warnings in older Solc versions. |
| 638 | } |
| 639 | |
| 640 | function _pureChainId() private pure returns (uint256 chainId) { |
| 641 | function() internal view returns (uint256) fnIn = _viewChainId; |
| 642 | function() internal pure returns (uint256) pureChainId; |
| 643 | assembly { |
| 644 | pureChainId := fnIn |
| 645 | } |
| 646 | chainId = pureChainId(); |
| 647 | } |
| 648 | } |
| 649 | |
| 650 | // Wrappers around cheatcodes to avoid footguns |
| 651 | abstract contract StdCheats is StdCheatsSafe { |
| 652 | using stdStorage for StdStorage; |
| 653 | |
| 654 | StdStorage private stdstore; |
| 655 | Vm private constant vm = Vm(address(uint160(uint256(keccak256("hevm cheat code"))))); |
| 656 | address private constant CONSOLE2_ADDRESS = 0x000000000000000000636F6e736F6c652e6c6f67; |
| 657 | |
| 658 | // Skip forward or rewind time by the specified number of seconds |
| 659 | function skip(uint256 time) internal virtual { |
| 660 | vm.warp(vm.getBlockTimestamp() + time); |
| 661 | } |
| 662 | |
| 663 | function rewind(uint256 time) internal virtual { |
| 664 | vm.warp(vm.getBlockTimestamp() - time); |
| 665 | } |
| 666 | |
| 667 | // Setup a prank from an address that has some ether |
| 668 | function hoax(address msgSender) internal virtual { |
| 669 | vm.deal(msgSender, 1 << 128); |
| 670 | vm.prank(msgSender); |
| 671 | } |
| 672 | |
| 673 | function hoax(address msgSender, uint256 give) internal virtual { |
| 674 | vm.deal(msgSender, give); |
| 675 | vm.prank(msgSender); |
| 676 | } |
| 677 | |
| 678 | function hoax(address msgSender, address origin) internal virtual { |
| 679 | vm.deal(msgSender, 1 << 128); |
| 680 | vm.prank(msgSender, origin); |
| 681 | } |
| 682 | |
| 683 | function hoax(address msgSender, address origin, uint256 give) internal virtual { |
| 684 | vm.deal(msgSender, give); |
| 685 | vm.prank(msgSender, origin); |
| 686 | } |
| 687 | |
| 688 | // Start perpetual prank from an address that has some ether |
| 689 | function startHoax(address msgSender) internal virtual { |
| 690 | vm.deal(msgSender, 1 << 128); |
| 691 | vm.startPrank(msgSender); |
| 692 | } |
| 693 | |
| 694 | function startHoax(address msgSender, uint256 give) internal virtual { |
| 695 | vm.deal(msgSender, give); |
| 696 | vm.startPrank(msgSender); |
| 697 | } |
| 698 | |
| 699 | // Start perpetual prank from an address that has some ether |
| 700 | // tx.origin is set to the origin parameter |
| 701 | function startHoax(address msgSender, address origin) internal virtual { |
| 702 | vm.deal(msgSender, 1 << 128); |
| 703 | vm.startPrank(msgSender, origin); |
| 704 | } |
| 705 | |
| 706 | function startHoax(address msgSender, address origin, uint256 give) internal virtual { |
| 707 | vm.deal(msgSender, give); |
| 708 | vm.startPrank(msgSender, origin); |
| 709 | } |
| 710 | |
| 711 | function changePrank(address msgSender) internal virtual { |
| 712 | console2_log_StdCheats("changePrank is deprecated. Please use vm.startPrank instead."); |
| 713 | vm.stopPrank(); |
| 714 | vm.startPrank(msgSender); |
| 715 | } |
| 716 | |
| 717 | function changePrank(address msgSender, address txOrigin) internal virtual { |
| 718 | console2_log_StdCheats("changePrank is deprecated. Please use vm.startPrank instead."); |
| 719 | vm.stopPrank(); |
| 720 | vm.startPrank(msgSender, txOrigin); |
| 721 | } |
| 722 | |
| 723 | // The same as Vm's `deal` |
| 724 | // Use the alternative signature for ERC20 tokens |
| 725 | function deal(address to, uint256 give) internal virtual { |
| 726 | vm.deal(to, give); |
| 727 | } |
| 728 | |
| 729 | // Set the balance of an account for any ERC20 token |
| 730 | // Use the alternative signature to update `totalSupply` |
| 731 | function deal(address token, address to, uint256 give) internal virtual { |
| 732 | deal(token, to, give, false); |
| 733 | } |
| 734 | |
| 735 | // Set the balance of an account for any ERC1155 token |
| 736 | // Use the alternative signature to update `totalSupply` |
| 737 | function dealERC1155(address token, address to, uint256 id, uint256 give) internal virtual { |
| 738 | dealERC1155(token, to, id, give, false); |
| 739 | } |
| 740 | |
| 741 | function deal(address token, address to, uint256 give, bool adjust) internal virtual { |
| 742 | // get current balance |
| 743 | (, bytes memory balData) = token.staticcall(abi.encodeWithSelector(0x70a08231, to)); |
| 744 | uint256 prevBal = abi.decode(balData, (uint256)); |
| 745 | |
| 746 | // update balance |
| 747 | stdstore.target(token).sig(0x70a08231).with_key(to).checked_write(give); |
| 748 | |
| 749 | // update total supply |
| 750 | if (adjust) { |
| 751 | (, bytes memory totSupData) = token.staticcall(abi.encodeWithSelector(0x18160ddd)); |
| 752 | uint256 totSup = abi.decode(totSupData, (uint256)); |
| 753 | if (give < prevBal) { |
| 754 | totSup -= (prevBal - give); |
| 755 | } else { |
| 756 | totSup += (give - prevBal); |
| 757 | } |
| 758 | stdstore.target(token).sig(0x18160ddd).checked_write(totSup); |
| 759 | } |
| 760 | } |
| 761 | |
| 762 | function dealERC1155(address token, address to, uint256 id, uint256 give, bool adjust) internal virtual { |
| 763 | // get current balance |
| 764 | (, bytes memory balData) = token.staticcall(abi.encodeWithSelector(0x00fdd58e, to, id)); |
| 765 | uint256 prevBal = abi.decode(balData, (uint256)); |
| 766 | |
| 767 | // update balance |
| 768 | stdstore.target(token).sig(0x00fdd58e).with_key(to).with_key(id).checked_write(give); |
| 769 | |
| 770 | // update total supply |
| 771 | if (adjust) { |
| 772 | (, bytes memory totSupData) = token.staticcall(abi.encodeWithSelector(0xbd85b039, id)); |
| 773 | require( |
| 774 | totSupData.length != 0, |
| 775 | "StdCheats deal(address,address,uint,uint,bool): target contract is not ERC1155Supply." |
| 776 | ); |
| 777 | uint256 totSup = abi.decode(totSupData, (uint256)); |
| 778 | if (give < prevBal) { |
| 779 | totSup -= (prevBal - give); |
| 780 | } else { |
| 781 | totSup += (give - prevBal); |
| 782 | } |
| 783 | stdstore.target(token).sig(0xbd85b039).with_key(id).checked_write(totSup); |
| 784 | } |
| 785 | } |
| 786 | |
| 787 | function dealERC721(address token, address to, uint256 id) internal virtual { |
| 788 | // check if token id is already minted and the actual owner. |
| 789 | (bool successMinted, bytes memory ownerData) = token.staticcall(abi.encodeWithSelector(0x6352211e, id)); |
| 790 | require(successMinted, "StdCheats deal(address,address,uint,bool): id not minted."); |
| 791 | |
| 792 | // get owner current balance |
| 793 | (, bytes memory fromBalData) = |
| 794 | token.staticcall(abi.encodeWithSelector(0x70a08231, abi.decode(ownerData, (address)))); |
| 795 | uint256 fromPrevBal = abi.decode(fromBalData, (uint256)); |
| 796 | |
| 797 | // get new user current balance |
| 798 | (, bytes memory toBalData) = token.staticcall(abi.encodeWithSelector(0x70a08231, to)); |
| 799 | uint256 toPrevBal = abi.decode(toBalData, (uint256)); |
| 800 | |
| 801 | // update balances |
| 802 | stdstore.target(token).sig(0x70a08231).with_key(abi.decode(ownerData, (address))).checked_write(--fromPrevBal); |
| 803 | stdstore.target(token).sig(0x70a08231).with_key(to).checked_write(++toPrevBal); |
| 804 | |
| 805 | // update owner |
| 806 | stdstore.target(token).sig(0x6352211e).with_key(id).checked_write(to); |
| 807 | } |
| 808 | |
| 809 | function deployCodeTo(string memory what, address where) internal virtual { |
| 810 | deployCodeTo(what, "", 0, where); |
| 811 | } |
| 812 | |
| 813 | function deployCodeTo(string memory what, bytes memory args, address where) internal virtual { |
| 814 | deployCodeTo(what, args, 0, where); |
| 815 | } |
| 816 | |
| 817 | function deployCodeTo(string memory what, bytes memory args, uint256 value, address where) internal virtual { |
| 818 | bytes memory creationCode = vm.getCode(what); |
| 819 | vm.etch(where, abi.encodePacked(creationCode, args)); |
| 820 | (bool success, bytes memory runtimeBytecode) = where.call{value: value}(""); |
| 821 | require(success, "StdCheats deployCodeTo(string,bytes,uint256,address): Failed to create runtime bytecode."); |
| 822 | vm.etch(where, runtimeBytecode); |
| 823 | } |
| 824 | |
| 825 | // Used to prevent the compilation of console, which shortens the compilation time when console is not used elsewhere. |
| 826 | function console2_log_StdCheats(string memory p0) private view { |
| 827 | (bool status,) = address(CONSOLE2_ADDRESS).staticcall(abi.encodeWithSignature("log(string)", p0)); |
| 828 | status; |
| 829 | } |
| 830 | } |
| 831 |
0.0%
lib/forge-std/src/StdConstants.sol
Lines covered: 0 / 1 (0.0%)
| 1 | // SPDX-License-Identifier: MIT |
| 2 | pragma solidity >=0.6.2 <0.9.0; |
| 3 | |
| 4 | import {IMulticall3} from "./interfaces/IMulticall3.sol"; |
| 5 | import {Vm} from "./Vm.sol"; |
| 6 | |
| 7 | library StdConstants { |
| 8 | /// @dev Cheat code address. |
| 9 | /// Calculated as `address(uint160(uint256(keccak256("hevm cheat code"))))`. |
| 10 | Vm internal constant VM = Vm(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D); |
| 11 | /// @dev console.sol and console2.sol work by executing a staticcall to this address. |
| 12 | /// Calculated as `address(uint160(uint88(bytes11("console.log"))))`. |
| 13 | address internal constant CONSOLE = 0x000000000000000000636F6e736F6c652e6c6f67; |
| 14 | /// @dev Used when deploying with create2. |
| 15 | /// Taken from https://github.com/Arachnid/deterministic-deployment-proxy. |
| 16 | address internal constant CREATE2_FACTORY = 0x4e59b44847b379578588920cA78FbF26c0B4956C; |
| 17 | /// @dev The default address for tx.origin and msg.sender. |
| 18 | /// Calculated as `address(uint160(uint256(keccak256("foundry default caller"))))`. |
| 19 | address internal constant DEFAULT_SENDER = 0x1804c8AB1F12E6bbf3894d4083f33e07309d1f38; |
| 20 | /// @dev The address of the first contract `CREATE`d by a running test contract. |
| 21 | /// When running tests, each test contract is `CREATE`d by `DEFAULT_SENDER` with nonce 1. |
| 22 | /// Calculated as `VM.computeCreateAddress(VM.computeCreateAddress(DEFAULT_SENDER, 1), 1)`. |
| 23 | address internal constant DEFAULT_TEST_CONTRACT = 0x5615dEB798BB3E4dFa0139dFa1b3D433Cc23b72f; |
| 24 | /// @dev Deterministic deployment address of the Multicall3 contract. |
| 25 | /// Taken from https://www.multicall3.com. |
| 26 | IMulticall3 internal constant MULTICALL3_ADDRESS = IMulticall3(0xcA11bde05977b3631167028862bE2a173976CA11); |
| 27 | /// @dev The order of the secp256k1 curve. |
| 28 | uint256 internal constant SECP256K1_ORDER = |
| 29 | 115792089237316195423570985008687907852837564279074904382605163141518161494337; |
| 30 | } |
| 31 |
0.0%
lib/forge-std/src/StdError.sol
Lines covered: 0 / 10 (0.0%)
| 1 | // SPDX-License-Identifier: MIT |
| 2 | // Panics work for versions >=0.8.0, but we lowered the pragma to make this compatible with Test |
| 3 | pragma solidity >=0.6.2 <0.9.0; |
| 4 | |
| 5 | library stdError { |
| 6 | bytes public constant assertionError = abi.encodeWithSignature("Panic(uint256)", 0x01); |
| 7 | bytes public constant arithmeticError = abi.encodeWithSignature("Panic(uint256)", 0x11); |
| 8 | bytes public constant divisionError = abi.encodeWithSignature("Panic(uint256)", 0x12); |
| 9 | bytes public constant enumConversionError = abi.encodeWithSignature("Panic(uint256)", 0x21); |
| 10 | bytes public constant encodeStorageError = abi.encodeWithSignature("Panic(uint256)", 0x22); |
| 11 | bytes public constant popError = abi.encodeWithSignature("Panic(uint256)", 0x31); |
| 12 | bytes public constant indexOOBError = abi.encodeWithSignature("Panic(uint256)", 0x32); |
| 13 | bytes public constant memOverflowError = abi.encodeWithSignature("Panic(uint256)", 0x41); |
| 14 | bytes public constant zeroVarError = abi.encodeWithSignature("Panic(uint256)", 0x51); |
| 15 | } |
| 16 |
100.0%
lib/forge-std/src/StdInvariant.sol
Lines covered: 10 / 10 (100.0%)
| 1 | // SPDX-License-Identifier: MIT |
| 2 | pragma solidity >=0.6.2 <0.9.0; |
| 3 | |
| 4 | pragma experimental ABIEncoderV2; |
| 5 | |
| 6 | abstract contract StdInvariant { |
| 7 | struct FuzzSelector { |
| 8 | address addr; |
| 9 | bytes4[] selectors; |
| 10 | } |
| 11 | |
| 12 | struct FuzzArtifactSelector { |
| 13 | string artifact; |
| 14 | bytes4[] selectors; |
| 15 | } |
| 16 | |
| 17 | struct FuzzInterface { |
| 18 | address addr; |
| 19 | string[] artifacts; |
| 20 | } |
| 21 | |
| 22 | address[] private _excludedContracts; |
| 23 | address[] private _excludedSenders; |
| 24 | address[] private _targetedContracts; |
| 25 | address[] private _targetedSenders; |
| 26 | |
| 27 | string[] private _excludedArtifacts; |
| 28 | string[] private _targetedArtifacts; |
| 29 | |
| 30 | FuzzArtifactSelector[] private _targetedArtifactSelectors; |
| 31 | |
| 32 | FuzzSelector[] private _excludedSelectors; |
| 33 | FuzzSelector[] private _targetedSelectors; |
| 34 | |
| 35 | FuzzInterface[] private _targetedInterfaces; |
| 36 | |
| 37 | // Functions for users: |
| 38 | // These are intended to be called in tests. |
| 39 | |
| 40 | function excludeContract(address newExcludedContract_) internal { |
| 41 | _excludedContracts.push(newExcludedContract_); |
| 42 | } |
| 43 | |
| 44 | function excludeSelector(FuzzSelector memory newExcludedSelector_) internal { |
| 45 | _excludedSelectors.push(newExcludedSelector_); |
| 46 | } |
| 47 | |
| 48 | function excludeSender(address newExcludedSender_) internal { |
| 49 | _excludedSenders.push(newExcludedSender_); |
| 50 | } |
| 51 | |
| 52 | function excludeArtifact(string memory newExcludedArtifact_) internal { |
| 53 | _excludedArtifacts.push(newExcludedArtifact_); |
| 54 | } |
| 55 | |
| 56 | function targetArtifact(string memory newTargetedArtifact_) internal { |
| 57 | _targetedArtifacts.push(newTargetedArtifact_); |
| 58 | } |
| 59 | |
| 60 | function targetArtifactSelector(FuzzArtifactSelector memory newTargetedArtifactSelector_) internal { |
| 61 | _targetedArtifactSelectors.push(newTargetedArtifactSelector_); |
| 62 | } |
| 63 | |
| 64 | function targetContract(address newTargetedContract_) internal { |
| 65 | _targetedContracts.push(newTargetedContract_); |
| 66 | } |
| 67 | |
| 68 | function targetSelector(FuzzSelector memory newTargetedSelector_) internal { |
| 69 | _targetedSelectors.push(newTargetedSelector_); |
| 70 | } |
| 71 | |
| 72 | function targetSender(address newTargetedSender_) internal { |
| 73 | _targetedSenders.push(newTargetedSender_); |
| 74 | } |
| 75 | |
| 76 | function targetInterface(FuzzInterface memory newTargetedInterface_) internal { |
| 77 | _targetedInterfaces.push(newTargetedInterface_); |
| 78 | } |
| 79 | |
| 80 | // Functions for forge: |
| 81 | // These are called by forge to run invariant tests and don't need to be called in tests. |
| 82 | |
| 83 | function excludeArtifacts() public view returns (string[] memory excludedArtifacts_) { |
| 84 | excludedArtifacts_ = _excludedArtifacts; |
| 85 | } |
| 86 | |
| 87 | function excludeContracts() public view returns (address[] memory excludedContracts_) { |
| 88 | excludedContracts_ = _excludedContracts; |
| 89 | } |
| 90 | |
| 91 | function excludeSelectors() public view returns (FuzzSelector[] memory excludedSelectors_) { |
| 92 | excludedSelectors_ = _excludedSelectors; |
| 93 | } |
| 94 | |
| 95 | function excludeSenders() public view returns (address[] memory excludedSenders_) { |
| 96 | excludedSenders_ = _excludedSenders; |
| 97 | } |
| 98 | |
| 99 | function targetArtifacts() public view returns (string[] memory targetedArtifacts_) { |
| 100 | targetedArtifacts_ = _targetedArtifacts; |
| 101 | } |
| 102 | |
| 103 | function targetArtifactSelectors() public view returns (FuzzArtifactSelector[] memory targetedArtifactSelectors_) { |
| 104 | targetedArtifactSelectors_ = _targetedArtifactSelectors; |
| 105 | } |
| 106 | |
| 107 | function targetContracts() public view returns (address[] memory targetedContracts_) { |
| 108 | targetedContracts_ = _targetedContracts; |
| 109 | } |
| 110 | |
| 111 | function targetSelectors() public view returns (FuzzSelector[] memory targetedSelectors_) { |
| 112 | targetedSelectors_ = _targetedSelectors; |
| 113 | } |
| 114 | |
| 115 | function targetSenders() public view returns (address[] memory targetedSenders_) { |
| 116 | targetedSenders_ = _targetedSenders; |
| 117 | } |
| 118 | |
| 119 | function targetInterfaces() public view returns (FuzzInterface[] memory targetedInterfaces_) { |
| 120 | targetedInterfaces_ = _targetedInterfaces; |
| 121 | } |
| 122 | } |
| 123 |
0.0%
lib/forge-std/src/StdJson.sol
Lines covered: 0 / 1 (0.0%)
| 1 | // SPDX-License-Identifier: MIT |
| 2 | pragma solidity >=0.6.0 <0.9.0; |
| 3 | |
| 4 | pragma experimental ABIEncoderV2; |
| 5 | |
| 6 | import {VmSafe} from "./Vm.sol"; |
| 7 | |
| 8 | // Helpers for parsing and writing JSON files |
| 9 | // To parse: |
| 10 | // ``` |
| 11 | // using stdJson for string; |
| 12 | // string memory json = vm.readFile("<some_path>"); |
| 13 | // json.readUint("<json_path>"); |
| 14 | // ``` |
| 15 | // To write: |
| 16 | // ``` |
| 17 | // using stdJson for string; |
| 18 | // string memory json = "json"; |
| 19 | // json.serialize("a", uint256(123)); |
| 20 | // string memory semiFinal = json.serialize("b", string("test")); |
| 21 | // string memory finalJson = json.serialize("c", semiFinal); |
| 22 | // finalJson.write("<some_path>"); |
| 23 | // ``` |
| 24 | |
| 25 | library stdJson { |
| 26 | VmSafe private constant vm = VmSafe(address(uint160(uint256(keccak256("hevm cheat code"))))); |
| 27 | |
| 28 | function keyExists(string memory json, string memory key) internal view returns (bool) { |
| 29 | return vm.keyExistsJson(json, key); |
| 30 | } |
| 31 | |
| 32 | function parseRaw(string memory json, string memory key) internal pure returns (bytes memory) { |
| 33 | return vm.parseJson(json, key); |
| 34 | } |
| 35 | |
| 36 | function readUint(string memory json, string memory key) internal pure returns (uint256) { |
| 37 | return vm.parseJsonUint(json, key); |
| 38 | } |
| 39 | |
| 40 | function readUintArray(string memory json, string memory key) internal pure returns (uint256[] memory) { |
| 41 | return vm.parseJsonUintArray(json, key); |
| 42 | } |
| 43 | |
| 44 | function readInt(string memory json, string memory key) internal pure returns (int256) { |
| 45 | return vm.parseJsonInt(json, key); |
| 46 | } |
| 47 | |
| 48 | function readIntArray(string memory json, string memory key) internal pure returns (int256[] memory) { |
| 49 | return vm.parseJsonIntArray(json, key); |
| 50 | } |
| 51 | |
| 52 | function readBytes32(string memory json, string memory key) internal pure returns (bytes32) { |
| 53 | return vm.parseJsonBytes32(json, key); |
| 54 | } |
| 55 | |
| 56 | function readBytes32Array(string memory json, string memory key) internal pure returns (bytes32[] memory) { |
| 57 | return vm.parseJsonBytes32Array(json, key); |
| 58 | } |
| 59 | |
| 60 | function readString(string memory json, string memory key) internal pure returns (string memory) { |
| 61 | return vm.parseJsonString(json, key); |
| 62 | } |
| 63 | |
| 64 | function readStringArray(string memory json, string memory key) internal pure returns (string[] memory) { |
| 65 | return vm.parseJsonStringArray(json, key); |
| 66 | } |
| 67 | |
| 68 | function readAddress(string memory json, string memory key) internal pure returns (address) { |
| 69 | return vm.parseJsonAddress(json, key); |
| 70 | } |
| 71 | |
| 72 | function readAddressArray(string memory json, string memory key) internal pure returns (address[] memory) { |
| 73 | return vm.parseJsonAddressArray(json, key); |
| 74 | } |
| 75 | |
| 76 | function readBool(string memory json, string memory key) internal pure returns (bool) { |
| 77 | return vm.parseJsonBool(json, key); |
| 78 | } |
| 79 | |
| 80 | function readBoolArray(string memory json, string memory key) internal pure returns (bool[] memory) { |
| 81 | return vm.parseJsonBoolArray(json, key); |
| 82 | } |
| 83 | |
| 84 | function readBytes(string memory json, string memory key) internal pure returns (bytes memory) { |
| 85 | return vm.parseJsonBytes(json, key); |
| 86 | } |
| 87 | |
| 88 | function readBytesArray(string memory json, string memory key) internal pure returns (bytes[] memory) { |
| 89 | return vm.parseJsonBytesArray(json, key); |
| 90 | } |
| 91 | |
| 92 | function readUintOr(string memory json, string memory key, uint256 defaultValue) internal view returns (uint256) { |
| 93 | return keyExists(json, key) ? readUint(json, key) : defaultValue; |
| 94 | } |
| 95 | |
| 96 | function readUintArrayOr(string memory json, string memory key, uint256[] memory defaultValue) |
| 97 | internal |
| 98 | view |
| 99 | returns (uint256[] memory) |
| 100 | { |
| 101 | return keyExists(json, key) ? readUintArray(json, key) : defaultValue; |
| 102 | } |
| 103 | |
| 104 | function readIntOr(string memory json, string memory key, int256 defaultValue) internal view returns (int256) { |
| 105 | return keyExists(json, key) ? readInt(json, key) : defaultValue; |
| 106 | } |
| 107 | |
| 108 | function readIntArrayOr(string memory json, string memory key, int256[] memory defaultValue) |
| 109 | internal |
| 110 | view |
| 111 | returns (int256[] memory) |
| 112 | { |
| 113 | return keyExists(json, key) ? readIntArray(json, key) : defaultValue; |
| 114 | } |
| 115 | |
| 116 | function readBytes32Or(string memory json, string memory key, bytes32 defaultValue) |
| 117 | internal |
| 118 | view |
| 119 | returns (bytes32) |
| 120 | { |
| 121 | return keyExists(json, key) ? readBytes32(json, key) : defaultValue; |
| 122 | } |
| 123 | |
| 124 | function readBytes32ArrayOr(string memory json, string memory key, bytes32[] memory defaultValue) |
| 125 | internal |
| 126 | view |
| 127 | returns (bytes32[] memory) |
| 128 | { |
| 129 | return keyExists(json, key) ? readBytes32Array(json, key) : defaultValue; |
| 130 | } |
| 131 | |
| 132 | function readStringOr(string memory json, string memory key, string memory defaultValue) |
| 133 | internal |
| 134 | view |
| 135 | returns (string memory) |
| 136 | { |
| 137 | return keyExists(json, key) ? readString(json, key) : defaultValue; |
| 138 | } |
| 139 | |
| 140 | function readStringArrayOr(string memory json, string memory key, string[] memory defaultValue) |
| 141 | internal |
| 142 | view |
| 143 | returns (string[] memory) |
| 144 | { |
| 145 | return keyExists(json, key) ? readStringArray(json, key) : defaultValue; |
| 146 | } |
| 147 | |
| 148 | function readAddressOr(string memory json, string memory key, address defaultValue) |
| 149 | internal |
| 150 | view |
| 151 | returns (address) |
| 152 | { |
| 153 | return keyExists(json, key) ? readAddress(json, key) : defaultValue; |
| 154 | } |
| 155 | |
| 156 | function readAddressArrayOr(string memory json, string memory key, address[] memory defaultValue) |
| 157 | internal |
| 158 | view |
| 159 | returns (address[] memory) |
| 160 | { |
| 161 | return keyExists(json, key) ? readAddressArray(json, key) : defaultValue; |
| 162 | } |
| 163 | |
| 164 | function readBoolOr(string memory json, string memory key, bool defaultValue) internal view returns (bool) { |
| 165 | return keyExists(json, key) ? readBool(json, key) : defaultValue; |
| 166 | } |
| 167 | |
| 168 | function readBoolArrayOr(string memory json, string memory key, bool[] memory defaultValue) |
| 169 | internal |
| 170 | view |
| 171 | returns (bool[] memory) |
| 172 | { |
| 173 | return keyExists(json, key) ? readBoolArray(json, key) : defaultValue; |
| 174 | } |
| 175 | |
| 176 | function readBytesOr(string memory json, string memory key, bytes memory defaultValue) |
| 177 | internal |
| 178 | view |
| 179 | returns (bytes memory) |
| 180 | { |
| 181 | return keyExists(json, key) ? readBytes(json, key) : defaultValue; |
| 182 | } |
| 183 | |
| 184 | function readBytesArrayOr(string memory json, string memory key, bytes[] memory defaultValue) |
| 185 | internal |
| 186 | view |
| 187 | returns (bytes[] memory) |
| 188 | { |
| 189 | return keyExists(json, key) ? readBytesArray(json, key) : defaultValue; |
| 190 | } |
| 191 | |
| 192 | function serialize(string memory jsonKey, string memory rootObject) internal returns (string memory) { |
| 193 | return vm.serializeJson(jsonKey, rootObject); |
| 194 | } |
| 195 | |
| 196 | function serialize(string memory jsonKey, string memory key, bool value) internal returns (string memory) { |
| 197 | return vm.serializeBool(jsonKey, key, value); |
| 198 | } |
| 199 | |
| 200 | function serialize(string memory jsonKey, string memory key, bool[] memory value) internal returns (string memory) { |
| 201 | return vm.serializeBool(jsonKey, key, value); |
| 202 | } |
| 203 | |
| 204 | function serialize(string memory jsonKey, string memory key, uint256 value) internal returns (string memory) { |
| 205 | return vm.serializeUint(jsonKey, key, value); |
| 206 | } |
| 207 | |
| 208 | function serialize(string memory jsonKey, string memory key, uint256[] memory value) |
| 209 | internal |
| 210 | returns (string memory) |
| 211 | { |
| 212 | return vm.serializeUint(jsonKey, key, value); |
| 213 | } |
| 214 | |
| 215 | function serialize(string memory jsonKey, string memory key, int256 value) internal returns (string memory) { |
| 216 | return vm.serializeInt(jsonKey, key, value); |
| 217 | } |
| 218 | |
| 219 | function serialize(string memory jsonKey, string memory key, int256[] memory value) |
| 220 | internal |
| 221 | returns (string memory) |
| 222 | { |
| 223 | return vm.serializeInt(jsonKey, key, value); |
| 224 | } |
| 225 | |
| 226 | function serialize(string memory jsonKey, string memory key, address value) internal returns (string memory) { |
| 227 | return vm.serializeAddress(jsonKey, key, value); |
| 228 | } |
| 229 | |
| 230 | function serialize(string memory jsonKey, string memory key, address[] memory value) |
| 231 | internal |
| 232 | returns (string memory) |
| 233 | { |
| 234 | return vm.serializeAddress(jsonKey, key, value); |
| 235 | } |
| 236 | |
| 237 | function serialize(string memory jsonKey, string memory key, bytes32 value) internal returns (string memory) { |
| 238 | return vm.serializeBytes32(jsonKey, key, value); |
| 239 | } |
| 240 | |
| 241 | function serialize(string memory jsonKey, string memory key, bytes32[] memory value) |
| 242 | internal |
| 243 | returns (string memory) |
| 244 | { |
| 245 | return vm.serializeBytes32(jsonKey, key, value); |
| 246 | } |
| 247 | |
| 248 | function serialize(string memory jsonKey, string memory key, bytes memory value) internal returns (string memory) { |
| 249 | return vm.serializeBytes(jsonKey, key, value); |
| 250 | } |
| 251 | |
| 252 | function serialize(string memory jsonKey, string memory key, bytes[] memory value) |
| 253 | internal |
| 254 | returns (string memory) |
| 255 | { |
| 256 | return vm.serializeBytes(jsonKey, key, value); |
| 257 | } |
| 258 | |
| 259 | function serialize(string memory jsonKey, string memory key, string memory value) internal returns (string memory) { |
| 260 | return vm.serializeString(jsonKey, key, value); |
| 261 | } |
| 262 | |
| 263 | function serialize(string memory jsonKey, string memory key, string[] memory value) |
| 264 | internal |
| 265 | returns (string memory) |
| 266 | { |
| 267 | return vm.serializeString(jsonKey, key, value); |
| 268 | } |
| 269 | |
| 270 | function write(string memory jsonKey, string memory path) internal { |
| 271 | vm.writeJson(jsonKey, path); |
| 272 | } |
| 273 | |
| 274 | function write(string memory jsonKey, string memory path, string memory valueKey) internal { |
| 275 | vm.writeJson(jsonKey, path, valueKey); |
| 276 | } |
| 277 | } |
| 278 |
0.0%
lib/forge-std/src/StdMath.sol
Lines covered: 0 / 1 (0.0%)
| 1 | // SPDX-License-Identifier: MIT |
| 2 | pragma solidity >=0.6.2 <0.9.0; |
| 3 | |
| 4 | library stdMath { |
| 5 | int256 private constant INT256_MIN = -57896044618658097711785492504343953926634992332820282019728792003956564819968; |
| 6 | |
| 7 | function abs(int256 a) internal pure returns (uint256) { |
| 8 | // Required or it will fail when `a = type(int256).min` |
| 9 | if (a == INT256_MIN) { |
| 10 | return 57896044618658097711785492504343953926634992332820282019728792003956564819968; |
| 11 | } |
| 12 | |
| 13 | return uint256(a > 0 ? a : -a); |
| 14 | } |
| 15 | |
| 16 | function delta(uint256 a, uint256 b) internal pure returns (uint256) { |
| 17 | return a > b ? a - b : b - a; |
| 18 | } |
| 19 | |
| 20 | function delta(int256 a, int256 b) internal pure returns (uint256) { |
| 21 | // a and b are of the same sign |
| 22 | // this works thanks to two's complement, the left-most bit is the sign bit |
| 23 | if ((a ^ b) > -1) { |
| 24 | return delta(abs(a), abs(b)); |
| 25 | } |
| 26 | |
| 27 | // a and b are of opposite signs |
| 28 | return abs(a) + abs(b); |
| 29 | } |
| 30 | |
| 31 | function percentDelta(uint256 a, uint256 b) internal pure returns (uint256) { |
| 32 | // Prevent division by zero |
| 33 | require(b != 0, "stdMath percentDelta(uint256,uint256): Divisor is zero"); |
| 34 | uint256 absDelta = delta(a, b); |
| 35 | |
| 36 | return absDelta * 1e18 / b; |
| 37 | } |
| 38 | |
| 39 | function percentDelta(int256 a, int256 b) internal pure returns (uint256) { |
| 40 | uint256 absDelta = delta(a, b); |
| 41 | uint256 absB = abs(b); |
| 42 | // Prevent division by zero |
| 43 | require(absB != 0, "stdMath percentDelta(int256,int256): Divisor is zero"); |
| 44 | |
| 45 | return absDelta * 1e18 / absB; |
| 46 | } |
| 47 | } |
| 48 |
0.0%
lib/forge-std/src/StdStorage.sol
Lines covered: 0 / 2 (0.0%)
| 1 | // SPDX-License-Identifier: MIT |
| 2 | pragma solidity >=0.6.2 <0.9.0; |
| 3 | |
| 4 | import {Vm} from "./Vm.sol"; |
| 5 | |
| 6 | struct FindData { |
| 7 | uint256 slot; |
| 8 | uint256 offsetLeft; |
| 9 | uint256 offsetRight; |
| 10 | bool found; |
| 11 | } |
| 12 | |
| 13 | struct StdStorage { |
| 14 | mapping(address => mapping(bytes4 => mapping(bytes32 => FindData))) finds; |
| 15 | bytes32[] _keys; |
| 16 | bytes4 _sig; |
| 17 | uint256 _depth; |
| 18 | address _target; |
| 19 | bytes32 _set; |
| 20 | bool _enable_packed_slots; |
| 21 | bytes _calldata; |
| 22 | } |
| 23 | |
| 24 | library stdStorageSafe { |
| 25 | event SlotFound(address who, bytes4 fsig, bytes32 keysHash, uint256 slot); |
| 26 | event WARNING_UninitedSlot(address who, uint256 slot); |
| 27 | |
| 28 | Vm private constant vm = Vm(address(uint160(uint256(keccak256("hevm cheat code"))))); |
| 29 | uint256 constant UINT256_MAX = 115792089237316195423570985008687907853269984665640564039457584007913129639935; |
| 30 | |
| 31 | function sigs(string memory sigStr) internal pure returns (bytes4) { |
| 32 | return bytes4(keccak256(bytes(sigStr))); |
| 33 | } |
| 34 | |
| 35 | function getCallParams(StdStorage storage self) internal view returns (bytes memory) { |
| 36 | if (self._calldata.length == 0) { |
| 37 | return flatten(self._keys); |
| 38 | } else { |
| 39 | return self._calldata; |
| 40 | } |
| 41 | } |
| 42 | |
| 43 | // Calls target contract with configured parameters |
| 44 | function callTarget(StdStorage storage self) internal view returns (bool, bytes32) { |
| 45 | bytes memory cd = abi.encodePacked(self._sig, getCallParams(self)); |
| 46 | (bool success, bytes memory rdat) = self._target.staticcall(cd); |
| 47 | bytes32 result = bytesToBytes32(rdat, 32 * self._depth); |
| 48 | |
| 49 | return (success, result); |
| 50 | } |
| 51 | |
| 52 | // Tries mutating slot value to determine if the targeted value is stored in it. |
| 53 | // If current value is 0, then we are setting slot value to type(uint256).max |
| 54 | // Otherwise, we set it to 0. That way, return value should always be affected. |
| 55 | function checkSlotMutatesCall(StdStorage storage self, bytes32 slot) internal returns (bool) { |
| 56 | bytes32 prevSlotValue = vm.load(self._target, slot); |
| 57 | (bool success, bytes32 prevReturnValue) = callTarget(self); |
| 58 | |
| 59 | bytes32 testVal = prevReturnValue == bytes32(0) ? bytes32(UINT256_MAX) : bytes32(0); |
| 60 | vm.store(self._target, slot, testVal); |
| 61 | |
| 62 | (, bytes32 newReturnValue) = callTarget(self); |
| 63 | |
| 64 | vm.store(self._target, slot, prevSlotValue); |
| 65 | |
| 66 | return (success && (prevReturnValue != newReturnValue)); |
| 67 | } |
| 68 | |
| 69 | // Tries setting one of the bits in slot to 1 until return value changes. |
| 70 | // Index of resulted bit is an offset packed slot has from left/right side |
| 71 | function findOffset(StdStorage storage self, bytes32 slot, bool left) internal returns (bool, uint256) { |
| 72 | for (uint256 offset = 0; offset < 256; offset++) { |
| 73 | uint256 valueToPut = left ? (1 << (255 - offset)) : (1 << offset); |
| 74 | vm.store(self._target, slot, bytes32(valueToPut)); |
| 75 | |
| 76 | (bool success, bytes32 data) = callTarget(self); |
| 77 | |
| 78 | if (success && (uint256(data) > 0)) { |
| 79 | return (true, offset); |
| 80 | } |
| 81 | } |
| 82 | return (false, 0); |
| 83 | } |
| 84 | |
| 85 | function findOffsets(StdStorage storage self, bytes32 slot) internal returns (bool, uint256, uint256) { |
| 86 | bytes32 prevSlotValue = vm.load(self._target, slot); |
| 87 | |
| 88 | (bool foundLeft, uint256 offsetLeft) = findOffset(self, slot, true); |
| 89 | (bool foundRight, uint256 offsetRight) = findOffset(self, slot, false); |
| 90 | |
| 91 | // `findOffset` may mutate slot value, so we are setting it to initial value |
| 92 | vm.store(self._target, slot, prevSlotValue); |
| 93 | return (foundLeft && foundRight, offsetLeft, offsetRight); |
| 94 | } |
| 95 | |
| 96 | function find(StdStorage storage self) internal returns (FindData storage) { |
| 97 | return find(self, true); |
| 98 | } |
| 99 | |
| 100 | /// @notice find an arbitrary storage slot given a function sig, input data, address of the contract and a value to check against |
| 101 | // slot complexity: |
| 102 | // if flat, will be bytes32(uint256(uint)); |
| 103 | // if map, will be keccak256(abi.encode(key, uint(slot))); |
| 104 | // if deep map, will be keccak256(abi.encode(key1, keccak256(abi.encode(key0, uint(slot))))); |
| 105 | // if map struct, will be bytes32(uint256(keccak256(abi.encode(key1, keccak256(abi.encode(key0, uint(slot)))))) + structFieldDepth); |
| 106 | function find(StdStorage storage self, bool _clear) internal returns (FindData storage) { |
| 107 | address who = self._target; |
| 108 | bytes4 fsig = self._sig; |
| 109 | uint256 field_depth = self._depth; |
| 110 | bytes memory params = getCallParams(self); |
| 111 | |
| 112 | // calldata to test against |
| 113 | if (self.finds[who][fsig][keccak256(abi.encodePacked(params, field_depth))].found) { |
| 114 | if (_clear) { |
| 115 | clear(self); |
| 116 | } |
| 117 | return self.finds[who][fsig][keccak256(abi.encodePacked(params, field_depth))]; |
| 118 | } |
| 119 | vm.record(); |
| 120 | (, bytes32 callResult) = callTarget(self); |
| 121 | (bytes32[] memory reads,) = vm.accesses(address(who)); |
| 122 | |
| 123 | if (reads.length == 0) { |
| 124 | revert("stdStorage find(StdStorage): No storage use detected for target."); |
| 125 | } else { |
| 126 | for (uint256 i = reads.length; --i >= 0;) { |
| 127 | bytes32 prev = vm.load(who, reads[i]); |
| 128 | if (prev == bytes32(0)) { |
| 129 | emit WARNING_UninitedSlot(who, uint256(reads[i])); |
| 130 | } |
| 131 | |
| 132 | if (!checkSlotMutatesCall(self, reads[i])) { |
| 133 | continue; |
| 134 | } |
| 135 | |
| 136 | (uint256 offsetLeft, uint256 offsetRight) = (0, 0); |
| 137 | |
| 138 | if (self._enable_packed_slots) { |
| 139 | bool found; |
| 140 | (found, offsetLeft, offsetRight) = findOffsets(self, reads[i]); |
| 141 | if (!found) { |
| 142 | continue; |
| 143 | } |
| 144 | } |
| 145 | |
| 146 | // Check that value between found offsets is equal to the current call result |
| 147 | uint256 curVal = (uint256(prev) & getMaskByOffsets(offsetLeft, offsetRight)) >> offsetRight; |
| 148 | |
| 149 | if (uint256(callResult) != curVal) { |
| 150 | continue; |
| 151 | } |
| 152 | |
| 153 | emit SlotFound(who, fsig, keccak256(abi.encodePacked(params, field_depth)), uint256(reads[i])); |
| 154 | self.finds[who][fsig][keccak256(abi.encodePacked(params, field_depth))] = |
| 155 | FindData(uint256(reads[i]), offsetLeft, offsetRight, true); |
| 156 | break; |
| 157 | } |
| 158 | } |
| 159 | |
| 160 | require( |
| 161 | self.finds[who][fsig][keccak256(abi.encodePacked(params, field_depth))].found, |
| 162 | "stdStorage find(StdStorage): Slot(s) not found." |
| 163 | ); |
| 164 | |
| 165 | if (_clear) { |
| 166 | clear(self); |
| 167 | } |
| 168 | return self.finds[who][fsig][keccak256(abi.encodePacked(params, field_depth))]; |
| 169 | } |
| 170 | |
| 171 | function target(StdStorage storage self, address _target) internal returns (StdStorage storage) { |
| 172 | self._target = _target; |
| 173 | return self; |
| 174 | } |
| 175 | |
| 176 | function sig(StdStorage storage self, bytes4 _sig) internal returns (StdStorage storage) { |
| 177 | self._sig = _sig; |
| 178 | return self; |
| 179 | } |
| 180 | |
| 181 | function sig(StdStorage storage self, string memory _sig) internal returns (StdStorage storage) { |
| 182 | self._sig = sigs(_sig); |
| 183 | return self; |
| 184 | } |
| 185 | |
| 186 | function with_calldata(StdStorage storage self, bytes memory _calldata) internal returns (StdStorage storage) { |
| 187 | self._calldata = _calldata; |
| 188 | return self; |
| 189 | } |
| 190 | |
| 191 | function with_key(StdStorage storage self, address who) internal returns (StdStorage storage) { |
| 192 | self._keys.push(bytes32(uint256(uint160(who)))); |
| 193 | return self; |
| 194 | } |
| 195 | |
| 196 | function with_key(StdStorage storage self, uint256 amt) internal returns (StdStorage storage) { |
| 197 | self._keys.push(bytes32(amt)); |
| 198 | return self; |
| 199 | } |
| 200 | |
| 201 | function with_key(StdStorage storage self, bytes32 key) internal returns (StdStorage storage) { |
| 202 | self._keys.push(key); |
| 203 | return self; |
| 204 | } |
| 205 | |
| 206 | function enable_packed_slots(StdStorage storage self) internal returns (StdStorage storage) { |
| 207 | self._enable_packed_slots = true; |
| 208 | return self; |
| 209 | } |
| 210 | |
| 211 | function depth(StdStorage storage self, uint256 _depth) internal returns (StdStorage storage) { |
| 212 | self._depth = _depth; |
| 213 | return self; |
| 214 | } |
| 215 | |
| 216 | function read(StdStorage storage self) private returns (bytes memory) { |
| 217 | FindData storage data = find(self, false); |
| 218 | uint256 mask = getMaskByOffsets(data.offsetLeft, data.offsetRight); |
| 219 | uint256 value = (uint256(vm.load(self._target, bytes32(data.slot))) & mask) >> data.offsetRight; |
| 220 | clear(self); |
| 221 | return abi.encode(value); |
| 222 | } |
| 223 | |
| 224 | function read_bytes32(StdStorage storage self) internal returns (bytes32) { |
| 225 | return abi.decode(read(self), (bytes32)); |
| 226 | } |
| 227 | |
| 228 | function read_bool(StdStorage storage self) internal returns (bool) { |
| 229 | int256 v = read_int(self); |
| 230 | if (v == 0) return false; |
| 231 | if (v == 1) return true; |
| 232 | revert("stdStorage read_bool(StdStorage): Cannot decode. Make sure you are reading a bool."); |
| 233 | } |
| 234 | |
| 235 | function read_address(StdStorage storage self) internal returns (address) { |
| 236 | return abi.decode(read(self), (address)); |
| 237 | } |
| 238 | |
| 239 | function read_uint(StdStorage storage self) internal returns (uint256) { |
| 240 | return abi.decode(read(self), (uint256)); |
| 241 | } |
| 242 | |
| 243 | function read_int(StdStorage storage self) internal returns (int256) { |
| 244 | return abi.decode(read(self), (int256)); |
| 245 | } |
| 246 | |
| 247 | function parent(StdStorage storage self) internal returns (uint256, bytes32) { |
| 248 | address who = self._target; |
| 249 | uint256 field_depth = self._depth; |
| 250 | vm.startMappingRecording(); |
| 251 | uint256 child = find(self, true).slot - field_depth; |
| 252 | (bool found, bytes32 key, bytes32 parent_slot) = vm.getMappingKeyAndParentOf(who, bytes32(child)); |
| 253 | if (!found) { |
| 254 | revert( |
| 255 | "stdStorage parent(StdStorage): Cannot find parent. Make sure you give a slot and startMappingRecording() has been called." |
| 256 | ); |
| 257 | } |
| 258 | return (uint256(parent_slot), key); |
| 259 | } |
| 260 | |
| 261 | function root(StdStorage storage self) internal returns (uint256) { |
| 262 | address who = self._target; |
| 263 | uint256 field_depth = self._depth; |
| 264 | vm.startMappingRecording(); |
| 265 | uint256 child = find(self, true).slot - field_depth; |
| 266 | bool found; |
| 267 | bytes32 root_slot; |
| 268 | bytes32 parent_slot; |
| 269 | (found,, parent_slot) = vm.getMappingKeyAndParentOf(who, bytes32(child)); |
| 270 | if (!found) { |
| 271 | revert( |
| 272 | "stdStorage root(StdStorage): Cannot find parent. Make sure you give a slot and startMappingRecording() has been called." |
| 273 | ); |
| 274 | } |
| 275 | while (found) { |
| 276 | root_slot = parent_slot; |
| 277 | (found,, parent_slot) = vm.getMappingKeyAndParentOf(who, bytes32(root_slot)); |
| 278 | } |
| 279 | return uint256(root_slot); |
| 280 | } |
| 281 | |
| 282 | function bytesToBytes32(bytes memory b, uint256 offset) private pure returns (bytes32) { |
| 283 | bytes32 out; |
| 284 | |
| 285 | uint256 max = b.length > 32 ? 32 : b.length; |
| 286 | for (uint256 i = 0; i < max; i++) { |
| 287 | out |= bytes32(b[offset + i] & 0xFF) >> (i * 8); |
| 288 | } |
| 289 | return out; |
| 290 | } |
| 291 | |
| 292 | function flatten(bytes32[] memory b) private pure returns (bytes memory) { |
| 293 | bytes memory result = new bytes(b.length * 32); |
| 294 | for (uint256 i = 0; i < b.length; i++) { |
| 295 | bytes32 k = b[i]; |
| 296 | /// @solidity memory-safe-assembly |
| 297 | assembly { |
| 298 | mstore(add(result, add(32, mul(32, i))), k) |
| 299 | } |
| 300 | } |
| 301 | |
| 302 | return result; |
| 303 | } |
| 304 | |
| 305 | function clear(StdStorage storage self) internal { |
| 306 | delete self._target; |
| 307 | delete self._sig; |
| 308 | delete self._keys; |
| 309 | delete self._depth; |
| 310 | delete self._enable_packed_slots; |
| 311 | delete self._calldata; |
| 312 | } |
| 313 | |
| 314 | // Returns mask which contains non-zero bits for values between `offsetLeft` and `offsetRight` |
| 315 | // (slotValue & mask) >> offsetRight will be the value of the given packed variable |
| 316 | function getMaskByOffsets(uint256 offsetLeft, uint256 offsetRight) internal pure returns (uint256 mask) { |
| 317 | // mask = ((1 << (256 - (offsetRight + offsetLeft))) - 1) << offsetRight; |
| 318 | // using assembly because (1 << 256) causes overflow |
| 319 | assembly { |
| 320 | mask := shl(offsetRight, sub(shl(sub(256, add(offsetRight, offsetLeft)), 1), 1)) |
| 321 | } |
| 322 | } |
| 323 | |
| 324 | // Returns slot value with updated packed variable. |
| 325 | function getUpdatedSlotValue(bytes32 curValue, uint256 varValue, uint256 offsetLeft, uint256 offsetRight) |
| 326 | internal |
| 327 | pure |
| 328 | returns (bytes32 newValue) |
| 329 | { |
| 330 | return bytes32((uint256(curValue) & ~getMaskByOffsets(offsetLeft, offsetRight)) | (varValue << offsetRight)); |
| 331 | } |
| 332 | } |
| 333 | |
| 334 | library stdStorage { |
| 335 | Vm private constant vm = Vm(address(uint160(uint256(keccak256("hevm cheat code"))))); |
| 336 | |
| 337 | function sigs(string memory sigStr) internal pure returns (bytes4) { |
| 338 | return stdStorageSafe.sigs(sigStr); |
| 339 | } |
| 340 | |
| 341 | function find(StdStorage storage self) internal returns (uint256) { |
| 342 | return find(self, true); |
| 343 | } |
| 344 | |
| 345 | function find(StdStorage storage self, bool _clear) internal returns (uint256) { |
| 346 | return stdStorageSafe.find(self, _clear).slot; |
| 347 | } |
| 348 | |
| 349 | function target(StdStorage storage self, address _target) internal returns (StdStorage storage) { |
| 350 | return stdStorageSafe.target(self, _target); |
| 351 | } |
| 352 | |
| 353 | function sig(StdStorage storage self, bytes4 _sig) internal returns (StdStorage storage) { |
| 354 | return stdStorageSafe.sig(self, _sig); |
| 355 | } |
| 356 | |
| 357 | function sig(StdStorage storage self, string memory _sig) internal returns (StdStorage storage) { |
| 358 | return stdStorageSafe.sig(self, _sig); |
| 359 | } |
| 360 | |
| 361 | function with_key(StdStorage storage self, address who) internal returns (StdStorage storage) { |
| 362 | return stdStorageSafe.with_key(self, who); |
| 363 | } |
| 364 | |
| 365 | function with_key(StdStorage storage self, uint256 amt) internal returns (StdStorage storage) { |
| 366 | return stdStorageSafe.with_key(self, amt); |
| 367 | } |
| 368 | |
| 369 | function with_key(StdStorage storage self, bytes32 key) internal returns (StdStorage storage) { |
| 370 | return stdStorageSafe.with_key(self, key); |
| 371 | } |
| 372 | |
| 373 | function with_calldata(StdStorage storage self, bytes memory _calldata) internal returns (StdStorage storage) { |
| 374 | return stdStorageSafe.with_calldata(self, _calldata); |
| 375 | } |
| 376 | |
| 377 | function enable_packed_slots(StdStorage storage self) internal returns (StdStorage storage) { |
| 378 | return stdStorageSafe.enable_packed_slots(self); |
| 379 | } |
| 380 | |
| 381 | function depth(StdStorage storage self, uint256 _depth) internal returns (StdStorage storage) { |
| 382 | return stdStorageSafe.depth(self, _depth); |
| 383 | } |
| 384 | |
| 385 | function clear(StdStorage storage self) internal { |
| 386 | stdStorageSafe.clear(self); |
| 387 | } |
| 388 | |
| 389 | function checked_write(StdStorage storage self, address who) internal { |
| 390 | checked_write(self, bytes32(uint256(uint160(who)))); |
| 391 | } |
| 392 | |
| 393 | function checked_write(StdStorage storage self, uint256 amt) internal { |
| 394 | checked_write(self, bytes32(amt)); |
| 395 | } |
| 396 | |
| 397 | function checked_write_int(StdStorage storage self, int256 val) internal { |
| 398 | checked_write(self, bytes32(uint256(val))); |
| 399 | } |
| 400 | |
| 401 | function checked_write(StdStorage storage self, bool write) internal { |
| 402 | bytes32 t; |
| 403 | /// @solidity memory-safe-assembly |
| 404 | assembly { |
| 405 | t := write |
| 406 | } |
| 407 | checked_write(self, t); |
| 408 | } |
| 409 | |
| 410 | function checked_write(StdStorage storage self, bytes32 set) internal { |
| 411 | address who = self._target; |
| 412 | bytes4 fsig = self._sig; |
| 413 | uint256 field_depth = self._depth; |
| 414 | bytes memory params = stdStorageSafe.getCallParams(self); |
| 415 | |
| 416 | if (!self.finds[who][fsig][keccak256(abi.encodePacked(params, field_depth))].found) { |
| 417 | find(self, false); |
| 418 | } |
| 419 | FindData storage data = self.finds[who][fsig][keccak256(abi.encodePacked(params, field_depth))]; |
| 420 | if ((data.offsetLeft + data.offsetRight) > 0) { |
| 421 | uint256 maxVal = 2 ** (256 - (data.offsetLeft + data.offsetRight)); |
| 422 | require( |
| 423 | uint256(set) < maxVal, |
| 424 | string( |
| 425 | abi.encodePacked( |
| 426 | "stdStorage find(StdStorage): Packed slot. We can't fit value greater than ", |
| 427 | vm.toString(maxVal) |
| 428 | ) |
| 429 | ) |
| 430 | ); |
| 431 | } |
| 432 | bytes32 curVal = vm.load(who, bytes32(data.slot)); |
| 433 | bytes32 valToSet = stdStorageSafe.getUpdatedSlotValue(curVal, uint256(set), data.offsetLeft, data.offsetRight); |
| 434 | |
| 435 | vm.store(who, bytes32(data.slot), valToSet); |
| 436 | |
| 437 | (bool success, bytes32 callResult) = stdStorageSafe.callTarget(self); |
| 438 | |
| 439 | if (!success || callResult != set) { |
| 440 | vm.store(who, bytes32(data.slot), curVal); |
| 441 | revert("stdStorage find(StdStorage): Failed to write value."); |
| 442 | } |
| 443 | clear(self); |
| 444 | } |
| 445 | |
| 446 | function read_bytes32(StdStorage storage self) internal returns (bytes32) { |
| 447 | return stdStorageSafe.read_bytes32(self); |
| 448 | } |
| 449 | |
| 450 | function read_bool(StdStorage storage self) internal returns (bool) { |
| 451 | return stdStorageSafe.read_bool(self); |
| 452 | } |
| 453 | |
| 454 | function read_address(StdStorage storage self) internal returns (address) { |
| 455 | return stdStorageSafe.read_address(self); |
| 456 | } |
| 457 | |
| 458 | function read_uint(StdStorage storage self) internal returns (uint256) { |
| 459 | return stdStorageSafe.read_uint(self); |
| 460 | } |
| 461 | |
| 462 | function read_int(StdStorage storage self) internal returns (int256) { |
| 463 | return stdStorageSafe.read_int(self); |
| 464 | } |
| 465 | |
| 466 | function parent(StdStorage storage self) internal returns (uint256, bytes32) { |
| 467 | return stdStorageSafe.parent(self); |
| 468 | } |
| 469 | |
| 470 | function root(StdStorage storage self) internal returns (uint256) { |
| 471 | return stdStorageSafe.root(self); |
| 472 | } |
| 473 | } |
| 474 |
0.0%
lib/forge-std/src/StdStyle.sol
Lines covered: 0 / 1 (0.0%)
| 1 | // SPDX-License-Identifier: MIT |
| 2 | pragma solidity >=0.4.22 <0.9.0; |
| 3 | |
| 4 | import {VmSafe} from "./Vm.sol"; |
| 5 | |
| 6 | library StdStyle { |
| 7 | VmSafe private constant vm = VmSafe(address(uint160(uint256(keccak256("hevm cheat code"))))); |
| 8 | |
| 9 | string constant RED = "\u001b[91m"; |
| 10 | string constant GREEN = "\u001b[92m"; |
| 11 | string constant YELLOW = "\u001b[93m"; |
| 12 | string constant BLUE = "\u001b[94m"; |
| 13 | string constant MAGENTA = "\u001b[95m"; |
| 14 | string constant CYAN = "\u001b[96m"; |
| 15 | string constant BOLD = "\u001b[1m"; |
| 16 | string constant DIM = "\u001b[2m"; |
| 17 | string constant ITALIC = "\u001b[3m"; |
| 18 | string constant UNDERLINE = "\u001b[4m"; |
| 19 | string constant INVERSE = "\u001b[7m"; |
| 20 | string constant RESET = "\u001b[0m"; |
| 21 | |
| 22 | function styleConcat(string memory style, string memory self) private pure returns (string memory) { |
| 23 | return string(abi.encodePacked(style, self, RESET)); |
| 24 | } |
| 25 | |
| 26 | function red(string memory self) internal pure returns (string memory) { |
| 27 | return styleConcat(RED, self); |
| 28 | } |
| 29 | |
| 30 | function red(uint256 self) internal pure returns (string memory) { |
| 31 | return red(vm.toString(self)); |
| 32 | } |
| 33 | |
| 34 | function red(int256 self) internal pure returns (string memory) { |
| 35 | return red(vm.toString(self)); |
| 36 | } |
| 37 | |
| 38 | function red(address self) internal pure returns (string memory) { |
| 39 | return red(vm.toString(self)); |
| 40 | } |
| 41 | |
| 42 | function red(bool self) internal pure returns (string memory) { |
| 43 | return red(vm.toString(self)); |
| 44 | } |
| 45 | |
| 46 | function redBytes(bytes memory self) internal pure returns (string memory) { |
| 47 | return red(vm.toString(self)); |
| 48 | } |
| 49 | |
| 50 | function redBytes32(bytes32 self) internal pure returns (string memory) { |
| 51 | return red(vm.toString(self)); |
| 52 | } |
| 53 | |
| 54 | function green(string memory self) internal pure returns (string memory) { |
| 55 | return styleConcat(GREEN, self); |
| 56 | } |
| 57 | |
| 58 | function green(uint256 self) internal pure returns (string memory) { |
| 59 | return green(vm.toString(self)); |
| 60 | } |
| 61 | |
| 62 | function green(int256 self) internal pure returns (string memory) { |
| 63 | return green(vm.toString(self)); |
| 64 | } |
| 65 | |
| 66 | function green(address self) internal pure returns (string memory) { |
| 67 | return green(vm.toString(self)); |
| 68 | } |
| 69 | |
| 70 | function green(bool self) internal pure returns (string memory) { |
| 71 | return green(vm.toString(self)); |
| 72 | } |
| 73 | |
| 74 | function greenBytes(bytes memory self) internal pure returns (string memory) { |
| 75 | return green(vm.toString(self)); |
| 76 | } |
| 77 | |
| 78 | function greenBytes32(bytes32 self) internal pure returns (string memory) { |
| 79 | return green(vm.toString(self)); |
| 80 | } |
| 81 | |
| 82 | function yellow(string memory self) internal pure returns (string memory) { |
| 83 | return styleConcat(YELLOW, self); |
| 84 | } |
| 85 | |
| 86 | function yellow(uint256 self) internal pure returns (string memory) { |
| 87 | return yellow(vm.toString(self)); |
| 88 | } |
| 89 | |
| 90 | function yellow(int256 self) internal pure returns (string memory) { |
| 91 | return yellow(vm.toString(self)); |
| 92 | } |
| 93 | |
| 94 | function yellow(address self) internal pure returns (string memory) { |
| 95 | return yellow(vm.toString(self)); |
| 96 | } |
| 97 | |
| 98 | function yellow(bool self) internal pure returns (string memory) { |
| 99 | return yellow(vm.toString(self)); |
| 100 | } |
| 101 | |
| 102 | function yellowBytes(bytes memory self) internal pure returns (string memory) { |
| 103 | return yellow(vm.toString(self)); |
| 104 | } |
| 105 | |
| 106 | function yellowBytes32(bytes32 self) internal pure returns (string memory) { |
| 107 | return yellow(vm.toString(self)); |
| 108 | } |
| 109 | |
| 110 | function blue(string memory self) internal pure returns (string memory) { |
| 111 | return styleConcat(BLUE, self); |
| 112 | } |
| 113 | |
| 114 | function blue(uint256 self) internal pure returns (string memory) { |
| 115 | return blue(vm.toString(self)); |
| 116 | } |
| 117 | |
| 118 | function blue(int256 self) internal pure returns (string memory) { |
| 119 | return blue(vm.toString(self)); |
| 120 | } |
| 121 | |
| 122 | function blue(address self) internal pure returns (string memory) { |
| 123 | return blue(vm.toString(self)); |
| 124 | } |
| 125 | |
| 126 | function blue(bool self) internal pure returns (string memory) { |
| 127 | return blue(vm.toString(self)); |
| 128 | } |
| 129 | |
| 130 | function blueBytes(bytes memory self) internal pure returns (string memory) { |
| 131 | return blue(vm.toString(self)); |
| 132 | } |
| 133 | |
| 134 | function blueBytes32(bytes32 self) internal pure returns (string memory) { |
| 135 | return blue(vm.toString(self)); |
| 136 | } |
| 137 | |
| 138 | function magenta(string memory self) internal pure returns (string memory) { |
| 139 | return styleConcat(MAGENTA, self); |
| 140 | } |
| 141 | |
| 142 | function magenta(uint256 self) internal pure returns (string memory) { |
| 143 | return magenta(vm.toString(self)); |
| 144 | } |
| 145 | |
| 146 | function magenta(int256 self) internal pure returns (string memory) { |
| 147 | return magenta(vm.toString(self)); |
| 148 | } |
| 149 | |
| 150 | function magenta(address self) internal pure returns (string memory) { |
| 151 | return magenta(vm.toString(self)); |
| 152 | } |
| 153 | |
| 154 | function magenta(bool self) internal pure returns (string memory) { |
| 155 | return magenta(vm.toString(self)); |
| 156 | } |
| 157 | |
| 158 | function magentaBytes(bytes memory self) internal pure returns (string memory) { |
| 159 | return magenta(vm.toString(self)); |
| 160 | } |
| 161 | |
| 162 | function magentaBytes32(bytes32 self) internal pure returns (string memory) { |
| 163 | return magenta(vm.toString(self)); |
| 164 | } |
| 165 | |
| 166 | function cyan(string memory self) internal pure returns (string memory) { |
| 167 | return styleConcat(CYAN, self); |
| 168 | } |
| 169 | |
| 170 | function cyan(uint256 self) internal pure returns (string memory) { |
| 171 | return cyan(vm.toString(self)); |
| 172 | } |
| 173 | |
| 174 | function cyan(int256 self) internal pure returns (string memory) { |
| 175 | return cyan(vm.toString(self)); |
| 176 | } |
| 177 | |
| 178 | function cyan(address self) internal pure returns (string memory) { |
| 179 | return cyan(vm.toString(self)); |
| 180 | } |
| 181 | |
| 182 | function cyan(bool self) internal pure returns (string memory) { |
| 183 | return cyan(vm.toString(self)); |
| 184 | } |
| 185 | |
| 186 | function cyanBytes(bytes memory self) internal pure returns (string memory) { |
| 187 | return cyan(vm.toString(self)); |
| 188 | } |
| 189 | |
| 190 | function cyanBytes32(bytes32 self) internal pure returns (string memory) { |
| 191 | return cyan(vm.toString(self)); |
| 192 | } |
| 193 | |
| 194 | function bold(string memory self) internal pure returns (string memory) { |
| 195 | return styleConcat(BOLD, self); |
| 196 | } |
| 197 | |
| 198 | function bold(uint256 self) internal pure returns (string memory) { |
| 199 | return bold(vm.toString(self)); |
| 200 | } |
| 201 | |
| 202 | function bold(int256 self) internal pure returns (string memory) { |
| 203 | return bold(vm.toString(self)); |
| 204 | } |
| 205 | |
| 206 | function bold(address self) internal pure returns (string memory) { |
| 207 | return bold(vm.toString(self)); |
| 208 | } |
| 209 | |
| 210 | function bold(bool self) internal pure returns (string memory) { |
| 211 | return bold(vm.toString(self)); |
| 212 | } |
| 213 | |
| 214 | function boldBytes(bytes memory self) internal pure returns (string memory) { |
| 215 | return bold(vm.toString(self)); |
| 216 | } |
| 217 | |
| 218 | function boldBytes32(bytes32 self) internal pure returns (string memory) { |
| 219 | return bold(vm.toString(self)); |
| 220 | } |
| 221 | |
| 222 | function dim(string memory self) internal pure returns (string memory) { |
| 223 | return styleConcat(DIM, self); |
| 224 | } |
| 225 | |
| 226 | function dim(uint256 self) internal pure returns (string memory) { |
| 227 | return dim(vm.toString(self)); |
| 228 | } |
| 229 | |
| 230 | function dim(int256 self) internal pure returns (string memory) { |
| 231 | return dim(vm.toString(self)); |
| 232 | } |
| 233 | |
| 234 | function dim(address self) internal pure returns (string memory) { |
| 235 | return dim(vm.toString(self)); |
| 236 | } |
| 237 | |
| 238 | function dim(bool self) internal pure returns (string memory) { |
| 239 | return dim(vm.toString(self)); |
| 240 | } |
| 241 | |
| 242 | function dimBytes(bytes memory self) internal pure returns (string memory) { |
| 243 | return dim(vm.toString(self)); |
| 244 | } |
| 245 | |
| 246 | function dimBytes32(bytes32 self) internal pure returns (string memory) { |
| 247 | return dim(vm.toString(self)); |
| 248 | } |
| 249 | |
| 250 | function italic(string memory self) internal pure returns (string memory) { |
| 251 | return styleConcat(ITALIC, self); |
| 252 | } |
| 253 | |
| 254 | function italic(uint256 self) internal pure returns (string memory) { |
| 255 | return italic(vm.toString(self)); |
| 256 | } |
| 257 | |
| 258 | function italic(int256 self) internal pure returns (string memory) { |
| 259 | return italic(vm.toString(self)); |
| 260 | } |
| 261 | |
| 262 | function italic(address self) internal pure returns (string memory) { |
| 263 | return italic(vm.toString(self)); |
| 264 | } |
| 265 | |
| 266 | function italic(bool self) internal pure returns (string memory) { |
| 267 | return italic(vm.toString(self)); |
| 268 | } |
| 269 | |
| 270 | function italicBytes(bytes memory self) internal pure returns (string memory) { |
| 271 | return italic(vm.toString(self)); |
| 272 | } |
| 273 | |
| 274 | function italicBytes32(bytes32 self) internal pure returns (string memory) { |
| 275 | return italic(vm.toString(self)); |
| 276 | } |
| 277 | |
| 278 | function underline(string memory self) internal pure returns (string memory) { |
| 279 | return styleConcat(UNDERLINE, self); |
| 280 | } |
| 281 | |
| 282 | function underline(uint256 self) internal pure returns (string memory) { |
| 283 | return underline(vm.toString(self)); |
| 284 | } |
| 285 | |
| 286 | function underline(int256 self) internal pure returns (string memory) { |
| 287 | return underline(vm.toString(self)); |
| 288 | } |
| 289 | |
| 290 | function underline(address self) internal pure returns (string memory) { |
| 291 | return underline(vm.toString(self)); |
| 292 | } |
| 293 | |
| 294 | function underline(bool self) internal pure returns (string memory) { |
| 295 | return underline(vm.toString(self)); |
| 296 | } |
| 297 | |
| 298 | function underlineBytes(bytes memory self) internal pure returns (string memory) { |
| 299 | return underline(vm.toString(self)); |
| 300 | } |
| 301 | |
| 302 | function underlineBytes32(bytes32 self) internal pure returns (string memory) { |
| 303 | return underline(vm.toString(self)); |
| 304 | } |
| 305 | |
| 306 | function inverse(string memory self) internal pure returns (string memory) { |
| 307 | return styleConcat(INVERSE, self); |
| 308 | } |
| 309 | |
| 310 | function inverse(uint256 self) internal pure returns (string memory) { |
| 311 | return inverse(vm.toString(self)); |
| 312 | } |
| 313 | |
| 314 | function inverse(int256 self) internal pure returns (string memory) { |
| 315 | return inverse(vm.toString(self)); |
| 316 | } |
| 317 | |
| 318 | function inverse(address self) internal pure returns (string memory) { |
| 319 | return inverse(vm.toString(self)); |
| 320 | } |
| 321 | |
| 322 | function inverse(bool self) internal pure returns (string memory) { |
| 323 | return inverse(vm.toString(self)); |
| 324 | } |
| 325 | |
| 326 | function inverseBytes(bytes memory self) internal pure returns (string memory) { |
| 327 | return inverse(vm.toString(self)); |
| 328 | } |
| 329 | |
| 330 | function inverseBytes32(bytes32 self) internal pure returns (string memory) { |
| 331 | return inverse(vm.toString(self)); |
| 332 | } |
| 333 | } |
| 334 |
0.0%
lib/forge-std/src/StdToml.sol
Lines covered: 0 / 1 (0.0%)
| 1 | // SPDX-License-Identifier: MIT |
| 2 | pragma solidity >=0.6.0 <0.9.0; |
| 3 | |
| 4 | pragma experimental ABIEncoderV2; |
| 5 | |
| 6 | import {VmSafe} from "./Vm.sol"; |
| 7 | |
| 8 | // Helpers for parsing and writing TOML files |
| 9 | // To parse: |
| 10 | // ``` |
| 11 | // using stdToml for string; |
| 12 | // string memory toml = vm.readFile("<some_path>"); |
| 13 | // toml.readUint("<json_path>"); |
| 14 | // ``` |
| 15 | // To write: |
| 16 | // ``` |
| 17 | // using stdToml for string; |
| 18 | // string memory json = "json"; |
| 19 | // json.serialize("a", uint256(123)); |
| 20 | // string memory semiFinal = json.serialize("b", string("test")); |
| 21 | // string memory finalJson = json.serialize("c", semiFinal); |
| 22 | // finalJson.write("<some_path>"); |
| 23 | // ``` |
| 24 | |
| 25 | library stdToml { |
| 26 | VmSafe private constant vm = VmSafe(address(uint160(uint256(keccak256("hevm cheat code"))))); |
| 27 | |
| 28 | function keyExists(string memory toml, string memory key) internal view returns (bool) { |
| 29 | return vm.keyExistsToml(toml, key); |
| 30 | } |
| 31 | |
| 32 | function parseRaw(string memory toml, string memory key) internal pure returns (bytes memory) { |
| 33 | return vm.parseToml(toml, key); |
| 34 | } |
| 35 | |
| 36 | function readUint(string memory toml, string memory key) internal pure returns (uint256) { |
| 37 | return vm.parseTomlUint(toml, key); |
| 38 | } |
| 39 | |
| 40 | function readUintArray(string memory toml, string memory key) internal pure returns (uint256[] memory) { |
| 41 | return vm.parseTomlUintArray(toml, key); |
| 42 | } |
| 43 | |
| 44 | function readInt(string memory toml, string memory key) internal pure returns (int256) { |
| 45 | return vm.parseTomlInt(toml, key); |
| 46 | } |
| 47 | |
| 48 | function readIntArray(string memory toml, string memory key) internal pure returns (int256[] memory) { |
| 49 | return vm.parseTomlIntArray(toml, key); |
| 50 | } |
| 51 | |
| 52 | function readBytes32(string memory toml, string memory key) internal pure returns (bytes32) { |
| 53 | return vm.parseTomlBytes32(toml, key); |
| 54 | } |
| 55 | |
| 56 | function readBytes32Array(string memory toml, string memory key) internal pure returns (bytes32[] memory) { |
| 57 | return vm.parseTomlBytes32Array(toml, key); |
| 58 | } |
| 59 | |
| 60 | function readString(string memory toml, string memory key) internal pure returns (string memory) { |
| 61 | return vm.parseTomlString(toml, key); |
| 62 | } |
| 63 | |
| 64 | function readStringArray(string memory toml, string memory key) internal pure returns (string[] memory) { |
| 65 | return vm.parseTomlStringArray(toml, key); |
| 66 | } |
| 67 | |
| 68 | function readAddress(string memory toml, string memory key) internal pure returns (address) { |
| 69 | return vm.parseTomlAddress(toml, key); |
| 70 | } |
| 71 | |
| 72 | function readAddressArray(string memory toml, string memory key) internal pure returns (address[] memory) { |
| 73 | return vm.parseTomlAddressArray(toml, key); |
| 74 | } |
| 75 | |
| 76 | function readBool(string memory toml, string memory key) internal pure returns (bool) { |
| 77 | return vm.parseTomlBool(toml, key); |
| 78 | } |
| 79 | |
| 80 | function readBoolArray(string memory toml, string memory key) internal pure returns (bool[] memory) { |
| 81 | return vm.parseTomlBoolArray(toml, key); |
| 82 | } |
| 83 | |
| 84 | function readBytes(string memory toml, string memory key) internal pure returns (bytes memory) { |
| 85 | return vm.parseTomlBytes(toml, key); |
| 86 | } |
| 87 | |
| 88 | function readBytesArray(string memory toml, string memory key) internal pure returns (bytes[] memory) { |
| 89 | return vm.parseTomlBytesArray(toml, key); |
| 90 | } |
| 91 | |
| 92 | function readUintOr(string memory toml, string memory key, uint256 defaultValue) internal view returns (uint256) { |
| 93 | return keyExists(toml, key) ? readUint(toml, key) : defaultValue; |
| 94 | } |
| 95 | |
| 96 | function readUintArrayOr(string memory toml, string memory key, uint256[] memory defaultValue) |
| 97 | internal |
| 98 | view |
| 99 | returns (uint256[] memory) |
| 100 | { |
| 101 | return keyExists(toml, key) ? readUintArray(toml, key) : defaultValue; |
| 102 | } |
| 103 | |
| 104 | function readIntOr(string memory toml, string memory key, int256 defaultValue) internal view returns (int256) { |
| 105 | return keyExists(toml, key) ? readInt(toml, key) : defaultValue; |
| 106 | } |
| 107 | |
| 108 | function readIntArrayOr(string memory toml, string memory key, int256[] memory defaultValue) |
| 109 | internal |
| 110 | view |
| 111 | returns (int256[] memory) |
| 112 | { |
| 113 | return keyExists(toml, key) ? readIntArray(toml, key) : defaultValue; |
| 114 | } |
| 115 | |
| 116 | function readBytes32Or(string memory toml, string memory key, bytes32 defaultValue) |
| 117 | internal |
| 118 | view |
| 119 | returns (bytes32) |
| 120 | { |
| 121 | return keyExists(toml, key) ? readBytes32(toml, key) : defaultValue; |
| 122 | } |
| 123 | |
| 124 | function readBytes32ArrayOr(string memory toml, string memory key, bytes32[] memory defaultValue) |
| 125 | internal |
| 126 | view |
| 127 | returns (bytes32[] memory) |
| 128 | { |
| 129 | return keyExists(toml, key) ? readBytes32Array(toml, key) : defaultValue; |
| 130 | } |
| 131 | |
| 132 | function readStringOr(string memory toml, string memory key, string memory defaultValue) |
| 133 | internal |
| 134 | view |
| 135 | returns (string memory) |
| 136 | { |
| 137 | return keyExists(toml, key) ? readString(toml, key) : defaultValue; |
| 138 | } |
| 139 | |
| 140 | function readStringArrayOr(string memory toml, string memory key, string[] memory defaultValue) |
| 141 | internal |
| 142 | view |
| 143 | returns (string[] memory) |
| 144 | { |
| 145 | return keyExists(toml, key) ? readStringArray(toml, key) : defaultValue; |
| 146 | } |
| 147 | |
| 148 | function readAddressOr(string memory toml, string memory key, address defaultValue) |
| 149 | internal |
| 150 | view |
| 151 | returns (address) |
| 152 | { |
| 153 | return keyExists(toml, key) ? readAddress(toml, key) : defaultValue; |
| 154 | } |
| 155 | |
| 156 | function readAddressArrayOr(string memory toml, string memory key, address[] memory defaultValue) |
| 157 | internal |
| 158 | view |
| 159 | returns (address[] memory) |
| 160 | { |
| 161 | return keyExists(toml, key) ? readAddressArray(toml, key) : defaultValue; |
| 162 | } |
| 163 | |
| 164 | function readBoolOr(string memory toml, string memory key, bool defaultValue) internal view returns (bool) { |
| 165 | return keyExists(toml, key) ? readBool(toml, key) : defaultValue; |
| 166 | } |
| 167 | |
| 168 | function readBoolArrayOr(string memory toml, string memory key, bool[] memory defaultValue) |
| 169 | internal |
| 170 | view |
| 171 | returns (bool[] memory) |
| 172 | { |
| 173 | return keyExists(toml, key) ? readBoolArray(toml, key) : defaultValue; |
| 174 | } |
| 175 | |
| 176 | function readBytesOr(string memory toml, string memory key, bytes memory defaultValue) |
| 177 | internal |
| 178 | view |
| 179 | returns (bytes memory) |
| 180 | { |
| 181 | return keyExists(toml, key) ? readBytes(toml, key) : defaultValue; |
| 182 | } |
| 183 | |
| 184 | function readBytesArrayOr(string memory toml, string memory key, bytes[] memory defaultValue) |
| 185 | internal |
| 186 | view |
| 187 | returns (bytes[] memory) |
| 188 | { |
| 189 | return keyExists(toml, key) ? readBytesArray(toml, key) : defaultValue; |
| 190 | } |
| 191 | |
| 192 | function serialize(string memory jsonKey, string memory rootObject) internal returns (string memory) { |
| 193 | return vm.serializeJson(jsonKey, rootObject); |
| 194 | } |
| 195 | |
| 196 | function serialize(string memory jsonKey, string memory key, bool value) internal returns (string memory) { |
| 197 | return vm.serializeBool(jsonKey, key, value); |
| 198 | } |
| 199 | |
| 200 | function serialize(string memory jsonKey, string memory key, bool[] memory value) internal returns (string memory) { |
| 201 | return vm.serializeBool(jsonKey, key, value); |
| 202 | } |
| 203 | |
| 204 | function serialize(string memory jsonKey, string memory key, uint256 value) internal returns (string memory) { |
| 205 | return vm.serializeUint(jsonKey, key, value); |
| 206 | } |
| 207 | |
| 208 | function serialize(string memory jsonKey, string memory key, uint256[] memory value) |
| 209 | internal |
| 210 | returns (string memory) |
| 211 | { |
| 212 | return vm.serializeUint(jsonKey, key, value); |
| 213 | } |
| 214 | |
| 215 | function serialize(string memory jsonKey, string memory key, int256 value) internal returns (string memory) { |
| 216 | return vm.serializeInt(jsonKey, key, value); |
| 217 | } |
| 218 | |
| 219 | function serialize(string memory jsonKey, string memory key, int256[] memory value) |
| 220 | internal |
| 221 | returns (string memory) |
| 222 | { |
| 223 | return vm.serializeInt(jsonKey, key, value); |
| 224 | } |
| 225 | |
| 226 | function serialize(string memory jsonKey, string memory key, address value) internal returns (string memory) { |
| 227 | return vm.serializeAddress(jsonKey, key, value); |
| 228 | } |
| 229 | |
| 230 | function serialize(string memory jsonKey, string memory key, address[] memory value) |
| 231 | internal |
| 232 | returns (string memory) |
| 233 | { |
| 234 | return vm.serializeAddress(jsonKey, key, value); |
| 235 | } |
| 236 | |
| 237 | function serialize(string memory jsonKey, string memory key, bytes32 value) internal returns (string memory) { |
| 238 | return vm.serializeBytes32(jsonKey, key, value); |
| 239 | } |
| 240 | |
| 241 | function serialize(string memory jsonKey, string memory key, bytes32[] memory value) |
| 242 | internal |
| 243 | returns (string memory) |
| 244 | { |
| 245 | return vm.serializeBytes32(jsonKey, key, value); |
| 246 | } |
| 247 | |
| 248 | function serialize(string memory jsonKey, string memory key, bytes memory value) internal returns (string memory) { |
| 249 | return vm.serializeBytes(jsonKey, key, value); |
| 250 | } |
| 251 | |
| 252 | function serialize(string memory jsonKey, string memory key, bytes[] memory value) |
| 253 | internal |
| 254 | returns (string memory) |
| 255 | { |
| 256 | return vm.serializeBytes(jsonKey, key, value); |
| 257 | } |
| 258 | |
| 259 | function serialize(string memory jsonKey, string memory key, string memory value) internal returns (string memory) { |
| 260 | return vm.serializeString(jsonKey, key, value); |
| 261 | } |
| 262 | |
| 263 | function serialize(string memory jsonKey, string memory key, string[] memory value) |
| 264 | internal |
| 265 | returns (string memory) |
| 266 | { |
| 267 | return vm.serializeString(jsonKey, key, value); |
| 268 | } |
| 269 | |
| 270 | function write(string memory jsonKey, string memory path) internal { |
| 271 | vm.writeToml(jsonKey, path); |
| 272 | } |
| 273 | |
| 274 | function write(string memory jsonKey, string memory path, string memory valueKey) internal { |
| 275 | vm.writeToml(jsonKey, path, valueKey); |
| 276 | } |
| 277 | } |
| 278 |
0.0%
lib/forge-std/src/StdUtils.sol
Lines covered: 0 / 0 (0.0%)
| 1 | // SPDX-License-Identifier: MIT |
| 2 | pragma solidity >=0.6.2 <0.9.0; |
| 3 | |
| 4 | pragma experimental ABIEncoderV2; |
| 5 | |
| 6 | import {IMulticall3} from "./interfaces/IMulticall3.sol"; |
| 7 | import {VmSafe} from "./Vm.sol"; |
| 8 | |
| 9 | abstract contract StdUtils { |
| 10 | /*////////////////////////////////////////////////////////////////////////// |
| 11 | CONSTANTS |
| 12 | //////////////////////////////////////////////////////////////////////////*/ |
| 13 | |
| 14 | IMulticall3 private constant multicall = IMulticall3(0xcA11bde05977b3631167028862bE2a173976CA11); |
| 15 | VmSafe private constant vm = VmSafe(address(uint160(uint256(keccak256("hevm cheat code"))))); |
| 16 | address private constant CONSOLE2_ADDRESS = 0x000000000000000000636F6e736F6c652e6c6f67; |
| 17 | uint256 private constant INT256_MIN_ABS = |
| 18 | 57896044618658097711785492504343953926634992332820282019728792003956564819968; |
| 19 | uint256 private constant SECP256K1_ORDER = |
| 20 | 115792089237316195423570985008687907852837564279074904382605163141518161494337; |
| 21 | uint256 private constant UINT256_MAX = |
| 22 | 115792089237316195423570985008687907853269984665640564039457584007913129639935; |
| 23 | |
| 24 | // Used by default when deploying with create2, https://github.com/Arachnid/deterministic-deployment-proxy. |
| 25 | address private constant CREATE2_FACTORY = 0x4e59b44847b379578588920cA78FbF26c0B4956C; |
| 26 | |
| 27 | /*////////////////////////////////////////////////////////////////////////// |
| 28 | INTERNAL FUNCTIONS |
| 29 | //////////////////////////////////////////////////////////////////////////*/ |
| 30 | |
| 31 | function _bound(uint256 x, uint256 min, uint256 max) internal pure virtual returns (uint256 result) { |
| 32 | require(min <= max, "StdUtils bound(uint256,uint256,uint256): Max is less than min."); |
| 33 | // If x is between min and max, return x directly. This is to ensure that dictionary values |
| 34 | // do not get shifted if the min is nonzero. More info: https://github.com/foundry-rs/forge-std/issues/188 |
| 35 | if (x >= min && x <= max) return x; |
| 36 | |
| 37 | uint256 size = max - min + 1; |
| 38 | |
| 39 | // If the value is 0, 1, 2, 3, wrap that to min, min+1, min+2, min+3. Similarly for the UINT256_MAX side. |
| 40 | // This helps ensure coverage of the min/max values. |
| 41 | if (x <= 3 && size > x) return min + x; |
| 42 | if (x >= UINT256_MAX - 3 && size > UINT256_MAX - x) return max - (UINT256_MAX - x); |
| 43 | |
| 44 | // Otherwise, wrap x into the range [min, max], i.e. the range is inclusive. |
| 45 | if (x > max) { |
| 46 | uint256 diff = x - max; |
| 47 | uint256 rem = diff % size; |
| 48 | if (rem == 0) return max; |
| 49 | result = min + rem - 1; |
| 50 | } else if (x < min) { |
| 51 | uint256 diff = min - x; |
| 52 | uint256 rem = diff % size; |
| 53 | if (rem == 0) return min; |
| 54 | result = max - rem + 1; |
| 55 | } |
| 56 | } |
| 57 | |
| 58 | function bound(uint256 x, uint256 min, uint256 max) internal pure virtual returns (uint256 result) { |
| 59 | result = _bound(x, min, max); |
| 60 | } |
| 61 | |
| 62 | function _bound(int256 x, int256 min, int256 max) internal pure virtual returns (int256 result) { |
| 63 | require(min <= max, "StdUtils bound(int256,int256,int256): Max is less than min."); |
| 64 | |
| 65 | // Shifting all int256 values to uint256 to use _bound function. The range of two types are: |
| 66 | // int256 : -(2**255) ~ (2**255 - 1) |
| 67 | // uint256: 0 ~ (2**256 - 1) |
| 68 | // So, add 2**255, INT256_MIN_ABS to the integer values. |
| 69 | // |
| 70 | // If the given integer value is -2**255, we cannot use `-uint256(-x)` because of the overflow. |
| 71 | // So, use `~uint256(x) + 1` instead. |
| 72 | uint256 _x = x < 0 ? (INT256_MIN_ABS - ~uint256(x) - 1) : (uint256(x) + INT256_MIN_ABS); |
| 73 | uint256 _min = min < 0 ? (INT256_MIN_ABS - ~uint256(min) - 1) : (uint256(min) + INT256_MIN_ABS); |
| 74 | uint256 _max = max < 0 ? (INT256_MIN_ABS - ~uint256(max) - 1) : (uint256(max) + INT256_MIN_ABS); |
| 75 | |
| 76 | uint256 y = _bound(_x, _min, _max); |
| 77 | |
| 78 | // To move it back to int256 value, subtract INT256_MIN_ABS at here. |
| 79 | result = y < INT256_MIN_ABS ? int256(~(INT256_MIN_ABS - y) + 1) : int256(y - INT256_MIN_ABS); |
| 80 | } |
| 81 | |
| 82 | function bound(int256 x, int256 min, int256 max) internal pure virtual returns (int256 result) { |
| 83 | result = _bound(x, min, max); |
| 84 | } |
| 85 | |
| 86 | function boundPrivateKey(uint256 privateKey) internal pure virtual returns (uint256 result) { |
| 87 | result = _bound(privateKey, 1, SECP256K1_ORDER - 1); |
| 88 | } |
| 89 | |
| 90 | function bytesToUint(bytes memory b) internal pure virtual returns (uint256) { |
| 91 | require(b.length <= 32, "StdUtils bytesToUint(bytes): Bytes length exceeds 32."); |
| 92 | return abi.decode(abi.encodePacked(new bytes(32 - b.length), b), (uint256)); |
| 93 | } |
| 94 | |
| 95 | /// @dev Compute the address a contract will be deployed at for a given deployer address and nonce |
| 96 | function computeCreateAddress(address deployer, uint256 nonce) internal pure virtual returns (address) { |
| 97 | console2_log_StdUtils("computeCreateAddress is deprecated. Please use vm.computeCreateAddress instead."); |
| 98 | return vm.computeCreateAddress(deployer, nonce); |
| 99 | } |
| 100 | |
| 101 | function computeCreate2Address(bytes32 salt, bytes32 initcodeHash, address deployer) |
| 102 | internal |
| 103 | pure |
| 104 | virtual |
| 105 | returns (address) |
| 106 | { |
| 107 | console2_log_StdUtils("computeCreate2Address is deprecated. Please use vm.computeCreate2Address instead."); |
| 108 | return vm.computeCreate2Address(salt, initcodeHash, deployer); |
| 109 | } |
| 110 | |
| 111 | /// @dev returns the address of a contract created with CREATE2 using the default CREATE2 deployer |
| 112 | function computeCreate2Address(bytes32 salt, bytes32 initCodeHash) internal pure returns (address) { |
| 113 | console2_log_StdUtils("computeCreate2Address is deprecated. Please use vm.computeCreate2Address instead."); |
| 114 | return vm.computeCreate2Address(salt, initCodeHash); |
| 115 | } |
| 116 | |
| 117 | /// @dev returns the hash of the init code (creation code + no args) used in CREATE2 with no constructor arguments |
| 118 | /// @param creationCode the creation code of a contract C, as returned by type(C).creationCode |
| 119 | function hashInitCode(bytes memory creationCode) internal pure returns (bytes32) { |
| 120 | return hashInitCode(creationCode, ""); |
| 121 | } |
| 122 | |
| 123 | /// @dev returns the hash of the init code (creation code + ABI-encoded args) used in CREATE2 |
| 124 | /// @param creationCode the creation code of a contract C, as returned by type(C).creationCode |
| 125 | /// @param args the ABI-encoded arguments to the constructor of C |
| 126 | function hashInitCode(bytes memory creationCode, bytes memory args) internal pure returns (bytes32) { |
| 127 | return keccak256(abi.encodePacked(creationCode, args)); |
| 128 | } |
| 129 | |
| 130 | // Performs a single call with Multicall3 to query the ERC-20 token balances of the given addresses. |
| 131 | function getTokenBalances(address token, address[] memory addresses) |
| 132 | internal |
| 133 | virtual |
| 134 | returns (uint256[] memory balances) |
| 135 | { |
| 136 | uint256 tokenCodeSize; |
| 137 | assembly { |
| 138 | tokenCodeSize := extcodesize(token) |
| 139 | } |
| 140 | require(tokenCodeSize > 0, "StdUtils getTokenBalances(address,address[]): Token address is not a contract."); |
| 141 | |
| 142 | // ABI encode the aggregate call to Multicall3. |
| 143 | uint256 length = addresses.length; |
| 144 | IMulticall3.Call[] memory calls = new IMulticall3.Call[](length); |
| 145 | for (uint256 i = 0; i < length; ++i) { |
| 146 | // 0x70a08231 = bytes4("balanceOf(address)")) |
| 147 | calls[i] = IMulticall3.Call({target: token, callData: abi.encodeWithSelector(0x70a08231, (addresses[i]))}); |
| 148 | } |
| 149 | |
| 150 | // Make the aggregate call. |
| 151 | (, bytes[] memory returnData) = multicall.aggregate(calls); |
| 152 | |
| 153 | // ABI decode the return data and return the balances. |
| 154 | balances = new uint256[](length); |
| 155 | for (uint256 i = 0; i < length; ++i) { |
| 156 | balances[i] = abi.decode(returnData[i], (uint256)); |
| 157 | } |
| 158 | } |
| 159 | |
| 160 | /*////////////////////////////////////////////////////////////////////////// |
| 161 | PRIVATE FUNCTIONS |
| 162 | //////////////////////////////////////////////////////////////////////////*/ |
| 163 | |
| 164 | function addressFromLast20Bytes(bytes32 bytesValue) private pure returns (address) { |
| 165 | return address(uint160(uint256(bytesValue))); |
| 166 | } |
| 167 | |
| 168 | // This section is used to prevent the compilation of console, which shortens the compilation time when console is |
| 169 | // not used elsewhere. We also trick the compiler into letting us make the console log methods as `pure` to avoid |
| 170 | // any breaking changes to function signatures. |
| 171 | function _castLogPayloadViewToPure(function(bytes memory) internal view fnIn) |
| 172 | internal |
| 173 | pure |
| 174 | returns (function(bytes memory) internal pure fnOut) |
| 175 | { |
| 176 | assembly { |
| 177 | fnOut := fnIn |
| 178 | } |
| 179 | } |
| 180 | |
| 181 | function _sendLogPayload(bytes memory payload) internal pure { |
| 182 | _castLogPayloadViewToPure(_sendLogPayloadView)(payload); |
| 183 | } |
| 184 | |
| 185 | function _sendLogPayloadView(bytes memory payload) private view { |
| 186 | uint256 payloadLength = payload.length; |
| 187 | address consoleAddress = CONSOLE2_ADDRESS; |
| 188 | /// @solidity memory-safe-assembly |
| 189 | assembly { |
| 190 | let payloadStart := add(payload, 32) |
| 191 | let r := staticcall(gas(), consoleAddress, payloadStart, payloadLength, 0, 0) |
| 192 | } |
| 193 | } |
| 194 | |
| 195 | function console2_log_StdUtils(string memory p0) private pure { |
| 196 | _sendLogPayload(abi.encodeWithSignature("log(string)", p0)); |
| 197 | } |
| 198 | |
| 199 | function console2_log_StdUtils(string memory p0, uint256 p1) private pure { |
| 200 | _sendLogPayload(abi.encodeWithSignature("log(string,uint256)", p0, p1)); |
| 201 | } |
| 202 | |
| 203 | function console2_log_StdUtils(string memory p0, string memory p1) private pure { |
| 204 | _sendLogPayload(abi.encodeWithSignature("log(string,string)", p0, p1)); |
| 205 | } |
| 206 | } |
| 207 |
100.0%
lib/forge-std/src/Test.sol
Lines covered: 1 / 1 (100.0%)
| 1 | // SPDX-License-Identifier: MIT |
| 2 | pragma solidity >=0.6.2 <0.9.0; |
| 3 | |
| 4 | pragma experimental ABIEncoderV2; |
| 5 | |
| 6 | // 💬 ABOUT |
| 7 | // Forge Std's default Test. |
| 8 | |
| 9 | // 🧩 MODULES |
| 10 | import {console} from "./console.sol"; |
| 11 | import {console2} from "./console2.sol"; |
| 12 | import {safeconsole} from "./safeconsole.sol"; |
| 13 | import {StdAssertions} from "./StdAssertions.sol"; |
| 14 | import {StdChains} from "./StdChains.sol"; |
| 15 | import {StdCheats} from "./StdCheats.sol"; |
| 16 | import {StdConstants} from "./StdConstants.sol"; |
| 17 | import {stdError} from "./StdError.sol"; |
| 18 | import {StdInvariant} from "./StdInvariant.sol"; |
| 19 | import {stdJson} from "./StdJson.sol"; |
| 20 | import {stdMath} from "./StdMath.sol"; |
| 21 | import {StdStorage, stdStorage} from "./StdStorage.sol"; |
| 22 | import {StdStyle} from "./StdStyle.sol"; |
| 23 | import {stdToml} from "./StdToml.sol"; |
| 24 | import {StdUtils} from "./StdUtils.sol"; |
| 25 | import {Vm} from "./Vm.sol"; |
| 26 | |
| 27 | // 📦 BOILERPLATE |
| 28 | import {TestBase} from "./Base.sol"; |
| 29 | |
| 30 | // ⭐️ TEST |
| 31 | abstract contract Test is TestBase, StdAssertions, StdChains, StdCheats, StdInvariant, StdUtils { |
| 32 | // Note: IS_TEST() must return true. |
| 33 | bool public IS_TEST = true; |
| 34 | } |
| 35 |
0.0%
lib/forge-std/src/Vm.sol
Lines covered: 0 / 0 (0.0%)
| 1 | // Automatically @generated by scripts/vm.py. Do not modify manually. |
| 2 | |
| 3 | // SPDX-License-Identifier: MIT OR Apache-2.0 |
| 4 | pragma solidity >=0.6.2 <0.9.0; |
| 5 | pragma experimental ABIEncoderV2; |
| 6 | |
| 7 | /// The `VmSafe` interface does not allow manipulation of the EVM state or other actions that may |
| 8 | /// result in Script simulations differing from on-chain execution. It is recommended to only use |
| 9 | /// these cheats in scripts. |
| 10 | interface VmSafe { |
| 11 | /// A modification applied to either `msg.sender` or `tx.origin`. Returned by `readCallers`. |
| 12 | enum CallerMode { |
| 13 | // No caller modification is currently active. |
| 14 | None, |
| 15 | // A one time broadcast triggered by a `vm.broadcast()` call is currently active. |
| 16 | Broadcast, |
| 17 | // A recurrent broadcast triggered by a `vm.startBroadcast()` call is currently active. |
| 18 | RecurrentBroadcast, |
| 19 | // A one time prank triggered by a `vm.prank()` call is currently active. |
| 20 | Prank, |
| 21 | // A recurrent prank triggered by a `vm.startPrank()` call is currently active. |
| 22 | RecurrentPrank |
| 23 | } |
| 24 | |
| 25 | /// The kind of account access that occurred. |
| 26 | enum AccountAccessKind { |
| 27 | // The account was called. |
| 28 | Call, |
| 29 | // The account was called via delegatecall. |
| 30 | DelegateCall, |
| 31 | // The account was called via callcode. |
| 32 | CallCode, |
| 33 | // The account was called via staticcall. |
| 34 | StaticCall, |
| 35 | // The account was created. |
| 36 | Create, |
| 37 | // The account was selfdestructed. |
| 38 | SelfDestruct, |
| 39 | // Synthetic access indicating the current context has resumed after a previous sub-context (AccountAccess). |
| 40 | Resume, |
| 41 | // The account's balance was read. |
| 42 | Balance, |
| 43 | // The account's codesize was read. |
| 44 | Extcodesize, |
| 45 | // The account's codehash was read. |
| 46 | Extcodehash, |
| 47 | // The account's code was copied. |
| 48 | Extcodecopy |
| 49 | } |
| 50 | |
| 51 | /// Forge execution contexts. |
| 52 | enum ForgeContext { |
| 53 | // Test group execution context (test, coverage or snapshot). |
| 54 | TestGroup, |
| 55 | // `forge test` execution context. |
| 56 | Test, |
| 57 | // `forge coverage` execution context. |
| 58 | Coverage, |
| 59 | // `forge snapshot` execution context. |
| 60 | Snapshot, |
| 61 | // Script group execution context (dry run, broadcast or resume). |
| 62 | ScriptGroup, |
| 63 | // `forge script` execution context. |
| 64 | ScriptDryRun, |
| 65 | // `forge script --broadcast` execution context. |
| 66 | ScriptBroadcast, |
| 67 | // `forge script --resume` execution context. |
| 68 | ScriptResume, |
| 69 | // Unknown `forge` execution context. |
| 70 | Unknown |
| 71 | } |
| 72 | |
| 73 | /// The transaction type (`txType`) of the broadcast. |
| 74 | enum BroadcastTxType { |
| 75 | // Represents a CALL broadcast tx. |
| 76 | Call, |
| 77 | // Represents a CREATE broadcast tx. |
| 78 | Create, |
| 79 | // Represents a CREATE2 broadcast tx. |
| 80 | Create2 |
| 81 | } |
| 82 | |
| 83 | /// An Ethereum log. Returned by `getRecordedLogs`. |
| 84 | struct Log { |
| 85 | // The topics of the log, including the signature, if any. |
| 86 | bytes32[] topics; |
| 87 | // The raw data of the log. |
| 88 | bytes data; |
| 89 | // The address of the log's emitter. |
| 90 | address emitter; |
| 91 | } |
| 92 | |
| 93 | /// An RPC URL and its alias. Returned by `rpcUrlStructs`. |
| 94 | struct Rpc { |
| 95 | // The alias of the RPC URL. |
| 96 | string key; |
| 97 | // The RPC URL. |
| 98 | string url; |
| 99 | } |
| 100 | |
| 101 | /// An RPC log object. Returned by `eth_getLogs`. |
| 102 | struct EthGetLogs { |
| 103 | // The address of the log's emitter. |
| 104 | address emitter; |
| 105 | // The topics of the log, including the signature, if any. |
| 106 | bytes32[] topics; |
| 107 | // The raw data of the log. |
| 108 | bytes data; |
| 109 | // The block hash. |
| 110 | bytes32 blockHash; |
| 111 | // The block number. |
| 112 | uint64 blockNumber; |
| 113 | // The transaction hash. |
| 114 | bytes32 transactionHash; |
| 115 | // The transaction index in the block. |
| 116 | uint64 transactionIndex; |
| 117 | // The log index. |
| 118 | uint256 logIndex; |
| 119 | // Whether the log was removed. |
| 120 | bool removed; |
| 121 | } |
| 122 | |
| 123 | /// A single entry in a directory listing. Returned by `readDir`. |
| 124 | struct DirEntry { |
| 125 | // The error message, if any. |
| 126 | string errorMessage; |
| 127 | // The path of the entry. |
| 128 | string path; |
| 129 | // The depth of the entry. |
| 130 | uint64 depth; |
| 131 | // Whether the entry is a directory. |
| 132 | bool isDir; |
| 133 | // Whether the entry is a symlink. |
| 134 | bool isSymlink; |
| 135 | } |
| 136 | |
| 137 | /// Metadata information about a file. |
| 138 | /// This structure is returned from the `fsMetadata` function and represents known |
| 139 | /// metadata about a file such as its permissions, size, modification |
| 140 | /// times, etc. |
| 141 | struct FsMetadata { |
| 142 | // True if this metadata is for a directory. |
| 143 | bool isDir; |
| 144 | // True if this metadata is for a symlink. |
| 145 | bool isSymlink; |
| 146 | // The size of the file, in bytes, this metadata is for. |
| 147 | uint256 length; |
| 148 | // True if this metadata is for a readonly (unwritable) file. |
| 149 | bool readOnly; |
| 150 | // The last modification time listed in this metadata. |
| 151 | uint256 modified; |
| 152 | // The last access time of this metadata. |
| 153 | uint256 accessed; |
| 154 | // The creation time listed in this metadata. |
| 155 | uint256 created; |
| 156 | } |
| 157 | |
| 158 | /// A wallet with a public and private key. |
| 159 | struct Wallet { |
| 160 | // The wallet's address. |
| 161 | address addr; |
| 162 | // The wallet's public key `X`. |
| 163 | uint256 publicKeyX; |
| 164 | // The wallet's public key `Y`. |
| 165 | uint256 publicKeyY; |
| 166 | // The wallet's private key. |
| 167 | uint256 privateKey; |
| 168 | } |
| 169 | |
| 170 | /// The result of a `tryFfi` call. |
| 171 | struct FfiResult { |
| 172 | // The exit code of the call. |
| 173 | int32 exitCode; |
| 174 | // The optionally hex-decoded `stdout` data. |
| 175 | bytes stdout; |
| 176 | // The `stderr` data. |
| 177 | bytes stderr; |
| 178 | } |
| 179 | |
| 180 | /// Information on the chain and fork. |
| 181 | struct ChainInfo { |
| 182 | // The fork identifier. Set to zero if no fork is active. |
| 183 | uint256 forkId; |
| 184 | // The chain ID of the current fork. |
| 185 | uint256 chainId; |
| 186 | } |
| 187 | |
| 188 | /// Information about a blockchain. |
| 189 | struct Chain { |
| 190 | // The chain name. |
| 191 | string name; |
| 192 | // The chain's Chain ID. |
| 193 | uint256 chainId; |
| 194 | // The chain's alias. (i.e. what gets specified in `foundry.toml`). |
| 195 | string chainAlias; |
| 196 | // A default RPC endpoint for this chain. |
| 197 | string rpcUrl; |
| 198 | } |
| 199 | |
| 200 | /// The result of a `stopAndReturnStateDiff` call. |
| 201 | struct AccountAccess { |
| 202 | // The chain and fork the access occurred. |
| 203 | ChainInfo chainInfo; |
| 204 | // The kind of account access that determines what the account is. |
| 205 | // If kind is Call, DelegateCall, StaticCall or CallCode, then the account is the callee. |
| 206 | // If kind is Create, then the account is the newly created account. |
| 207 | // If kind is SelfDestruct, then the account is the selfdestruct recipient. |
| 208 | // If kind is a Resume, then account represents a account context that has resumed. |
| 209 | AccountAccessKind kind; |
| 210 | // The account that was accessed. |
| 211 | // It's either the account created, callee or a selfdestruct recipient for CREATE, CALL or SELFDESTRUCT. |
| 212 | address account; |
| 213 | // What accessed the account. |
| 214 | address accessor; |
| 215 | // If the account was initialized or empty prior to the access. |
| 216 | // An account is considered initialized if it has code, a |
| 217 | // non-zero nonce, or a non-zero balance. |
| 218 | bool initialized; |
| 219 | // The previous balance of the accessed account. |
| 220 | uint256 oldBalance; |
| 221 | // The potential new balance of the accessed account. |
| 222 | // That is, all balance changes are recorded here, even if reverts occurred. |
| 223 | uint256 newBalance; |
| 224 | // Code of the account deployed by CREATE. |
| 225 | bytes deployedCode; |
| 226 | // Value passed along with the account access |
| 227 | uint256 value; |
| 228 | // Input data provided to the CREATE or CALL |
| 229 | bytes data; |
| 230 | // If this access reverted in either the current or parent context. |
| 231 | bool reverted; |
| 232 | // An ordered list of storage accesses made during an account access operation. |
| 233 | StorageAccess[] storageAccesses; |
| 234 | // Call depth traversed during the recording of state differences |
| 235 | uint64 depth; |
| 236 | // The previous nonce of the accessed account. |
| 237 | uint64 oldNonce; |
| 238 | // The new nonce of the accessed account. |
| 239 | uint64 newNonce; |
| 240 | } |
| 241 | |
| 242 | /// The storage accessed during an `AccountAccess`. |
| 243 | struct StorageAccess { |
| 244 | // The account whose storage was accessed. |
| 245 | address account; |
| 246 | // The slot that was accessed. |
| 247 | bytes32 slot; |
| 248 | // If the access was a write. |
| 249 | bool isWrite; |
| 250 | // The previous value of the slot. |
| 251 | bytes32 previousValue; |
| 252 | // The new value of the slot. |
| 253 | bytes32 newValue; |
| 254 | // If the access was reverted. |
| 255 | bool reverted; |
| 256 | } |
| 257 | |
| 258 | /// Gas used. Returned by `lastCallGas`. |
| 259 | struct Gas { |
| 260 | // The gas limit of the call. |
| 261 | uint64 gasLimit; |
| 262 | // The total gas used. |
| 263 | uint64 gasTotalUsed; |
| 264 | // DEPRECATED: The amount of gas used for memory expansion. Ref: <https://github.com/foundry-rs/foundry/pull/7934#pullrequestreview-2069236939> |
| 265 | uint64 gasMemoryUsed; |
| 266 | // The amount of gas refunded. |
| 267 | int64 gasRefunded; |
| 268 | // The amount of gas remaining. |
| 269 | uint64 gasRemaining; |
| 270 | } |
| 271 | |
| 272 | /// The result of the `stopDebugTraceRecording` call |
| 273 | struct DebugStep { |
| 274 | // The stack before executing the step of the run. |
| 275 | // stack\[0\] represents the top of the stack. |
| 276 | // and only stack data relevant to the opcode execution is contained. |
| 277 | uint256[] stack; |
| 278 | // The memory input data before executing the step of the run. |
| 279 | // only input data relevant to the opcode execution is contained. |
| 280 | // e.g. for MLOAD, it will have memory\[offset:offset+32\] copied here. |
| 281 | // the offset value can be get by the stack data. |
| 282 | bytes memoryInput; |
| 283 | // The opcode that was accessed. |
| 284 | uint8 opcode; |
| 285 | // The call depth of the step. |
| 286 | uint64 depth; |
| 287 | // Whether the call end up with out of gas error. |
| 288 | bool isOutOfGas; |
| 289 | // The contract address where the opcode is running |
| 290 | address contractAddr; |
| 291 | } |
| 292 | |
| 293 | /// Represents a transaction's broadcast details. |
| 294 | struct BroadcastTxSummary { |
| 295 | // The hash of the transaction that was broadcasted |
| 296 | bytes32 txHash; |
| 297 | // Represent the type of transaction among CALL, CREATE, CREATE2 |
| 298 | BroadcastTxType txType; |
| 299 | // The address of the contract that was called or created. |
| 300 | // This is address of the contract that is created if the txType is CREATE or CREATE2. |
| 301 | address contractAddress; |
| 302 | // The block number the transaction landed in. |
| 303 | uint64 blockNumber; |
| 304 | // Status of the transaction, retrieved from the transaction receipt. |
| 305 | bool success; |
| 306 | } |
| 307 | |
| 308 | /// Holds a signed EIP-7702 authorization for an authority account to delegate to an implementation. |
| 309 | struct SignedDelegation { |
| 310 | // The y-parity of the recovered secp256k1 signature (0 or 1). |
| 311 | uint8 v; |
| 312 | // First 32 bytes of the signature. |
| 313 | bytes32 r; |
| 314 | // Second 32 bytes of the signature. |
| 315 | bytes32 s; |
| 316 | // The current nonce of the authority account at signing time. |
| 317 | // Used to ensure signature can't be replayed after account nonce changes. |
| 318 | uint64 nonce; |
| 319 | // Address of the contract implementation that will be delegated to. |
| 320 | // Gets encoded into delegation code: 0xef0100 || implementation. |
| 321 | address implementation; |
| 322 | } |
| 323 | |
| 324 | /// Represents a "potential" revert reason from a single subsequent call when using `vm.assumeNoReverts`. |
| 325 | /// Reverts that match will result in a FOUNDRY::ASSUME rejection, whereas unmatched reverts will be surfaced |
| 326 | /// as normal. |
| 327 | struct PotentialRevert { |
| 328 | // The allowed origin of the revert opcode; address(0) allows reverts from any address |
| 329 | address reverter; |
| 330 | // When true, only matches on the beginning of the revert data, otherwise, matches on entire revert data |
| 331 | bool partialMatch; |
| 332 | // The data to use to match encountered reverts |
| 333 | bytes revertData; |
| 334 | } |
| 335 | |
| 336 | /// An EIP-2930 access list item. |
| 337 | struct AccessListItem { |
| 338 | // The address to be added in access list. |
| 339 | address target; |
| 340 | // The storage keys to be added in access list. |
| 341 | bytes32[] storageKeys; |
| 342 | } |
| 343 | |
| 344 | // ======== Crypto ======== |
| 345 | |
| 346 | /// Derives a private key from the name, labels the account with that name, and returns the wallet. |
| 347 | function createWallet(string calldata walletLabel) external returns (Wallet memory wallet); |
| 348 | |
| 349 | /// Generates a wallet from the private key and returns the wallet. |
| 350 | function createWallet(uint256 privateKey) external returns (Wallet memory wallet); |
| 351 | |
| 352 | /// Generates a wallet from the private key, labels the account with that name, and returns the wallet. |
| 353 | function createWallet(uint256 privateKey, string calldata walletLabel) external returns (Wallet memory wallet); |
| 354 | |
| 355 | /// Derive a private key from a provided mnemonic string (or mnemonic file path) |
| 356 | /// at the derivation path `m/44'/60'/0'/0/{index}`. |
| 357 | function deriveKey(string calldata mnemonic, uint32 index) external pure returns (uint256 privateKey); |
| 358 | |
| 359 | /// Derive a private key from a provided mnemonic string (or mnemonic file path) |
| 360 | /// at `{derivationPath}{index}`. |
| 361 | function deriveKey(string calldata mnemonic, string calldata derivationPath, uint32 index) |
| 362 | external |
| 363 | pure |
| 364 | returns (uint256 privateKey); |
| 365 | |
| 366 | /// Derive a private key from a provided mnemonic string (or mnemonic file path) in the specified language |
| 367 | /// at the derivation path `m/44'/60'/0'/0/{index}`. |
| 368 | function deriveKey(string calldata mnemonic, uint32 index, string calldata language) |
| 369 | external |
| 370 | pure |
| 371 | returns (uint256 privateKey); |
| 372 | |
| 373 | /// Derive a private key from a provided mnemonic string (or mnemonic file path) in the specified language |
| 374 | /// at `{derivationPath}{index}`. |
| 375 | function deriveKey(string calldata mnemonic, string calldata derivationPath, uint32 index, string calldata language) |
| 376 | external |
| 377 | pure |
| 378 | returns (uint256 privateKey); |
| 379 | |
| 380 | /// Derives secp256r1 public key from the provided `privateKey`. |
| 381 | function publicKeyP256(uint256 privateKey) external pure returns (uint256 publicKeyX, uint256 publicKeyY); |
| 382 | |
| 383 | /// Adds a private key to the local forge wallet and returns the address. |
| 384 | function rememberKey(uint256 privateKey) external returns (address keyAddr); |
| 385 | |
| 386 | /// Derive a set number of wallets from a mnemonic at the derivation path `m/44'/60'/0'/0/{0..count}`. |
| 387 | /// The respective private keys are saved to the local forge wallet for later use and their addresses are returned. |
| 388 | function rememberKeys(string calldata mnemonic, string calldata derivationPath, uint32 count) |
| 389 | external |
| 390 | returns (address[] memory keyAddrs); |
| 391 | |
| 392 | /// Derive a set number of wallets from a mnemonic in the specified language at the derivation path `m/44'/60'/0'/0/{0..count}`. |
| 393 | /// The respective private keys are saved to the local forge wallet for later use and their addresses are returned. |
| 394 | function rememberKeys( |
| 395 | string calldata mnemonic, |
| 396 | string calldata derivationPath, |
| 397 | string calldata language, |
| 398 | uint32 count |
| 399 | ) external returns (address[] memory keyAddrs); |
| 400 | |
| 401 | /// Signs data with a `Wallet`. |
| 402 | /// Returns a compact signature (`r`, `vs`) as per EIP-2098, where `vs` encodes both the |
| 403 | /// signature's `s` value, and the recovery id `v` in a single bytes32. |
| 404 | /// This format reduces the signature size from 65 to 64 bytes. |
| 405 | function signCompact(Wallet calldata wallet, bytes32 digest) external returns (bytes32 r, bytes32 vs); |
| 406 | |
| 407 | /// Signs `digest` with `privateKey` using the secp256k1 curve. |
| 408 | /// Returns a compact signature (`r`, `vs`) as per EIP-2098, where `vs` encodes both the |
| 409 | /// signature's `s` value, and the recovery id `v` in a single bytes32. |
| 410 | /// This format reduces the signature size from 65 to 64 bytes. |
| 411 | function signCompact(uint256 privateKey, bytes32 digest) external pure returns (bytes32 r, bytes32 vs); |
| 412 | |
| 413 | /// Signs `digest` with signer provided to script using the secp256k1 curve. |
| 414 | /// Returns a compact signature (`r`, `vs`) as per EIP-2098, where `vs` encodes both the |
| 415 | /// signature's `s` value, and the recovery id `v` in a single bytes32. |
| 416 | /// This format reduces the signature size from 65 to 64 bytes. |
| 417 | /// If `--sender` is provided, the signer with provided address is used, otherwise, |
| 418 | /// if exactly one signer is provided to the script, that signer is used. |
| 419 | /// Raises error if signer passed through `--sender` does not match any unlocked signers or |
| 420 | /// if `--sender` is not provided and not exactly one signer is passed to the script. |
| 421 | function signCompact(bytes32 digest) external pure returns (bytes32 r, bytes32 vs); |
| 422 | |
| 423 | /// Signs `digest` with signer provided to script using the secp256k1 curve. |
| 424 | /// Returns a compact signature (`r`, `vs`) as per EIP-2098, where `vs` encodes both the |
| 425 | /// signature's `s` value, and the recovery id `v` in a single bytes32. |
| 426 | /// This format reduces the signature size from 65 to 64 bytes. |
| 427 | /// Raises error if none of the signers passed into the script have provided address. |
| 428 | function signCompact(address signer, bytes32 digest) external pure returns (bytes32 r, bytes32 vs); |
| 429 | |
| 430 | /// Signs `digest` with `privateKey` using the secp256r1 curve. |
| 431 | function signP256(uint256 privateKey, bytes32 digest) external pure returns (bytes32 r, bytes32 s); |
| 432 | |
| 433 | /// Signs `digest` with `privateKey` on the secp256k1 curve, using the given `nonce` |
| 434 | /// as the raw ephemeral k value in ECDSA (instead of deriving it deterministically). |
| 435 | function signWithNonceUnsafe(uint256 privateKey, bytes32 digest, uint256 nonce) |
| 436 | external |
| 437 | pure |
| 438 | returns (uint8 v, bytes32 r, bytes32 s); |
| 439 | |
| 440 | /// Signs data with a `Wallet`. |
| 441 | function sign(Wallet calldata wallet, bytes32 digest) external returns (uint8 v, bytes32 r, bytes32 s); |
| 442 | |
| 443 | /// Signs `digest` with `privateKey` using the secp256k1 curve. |
| 444 | function sign(uint256 privateKey, bytes32 digest) external pure returns (uint8 v, bytes32 r, bytes32 s); |
| 445 | |
| 446 | /// Signs `digest` with signer provided to script using the secp256k1 curve. |
| 447 | /// If `--sender` is provided, the signer with provided address is used, otherwise, |
| 448 | /// if exactly one signer is provided to the script, that signer is used. |
| 449 | /// Raises error if signer passed through `--sender` does not match any unlocked signers or |
| 450 | /// if `--sender` is not provided and not exactly one signer is passed to the script. |
| 451 | function sign(bytes32 digest) external pure returns (uint8 v, bytes32 r, bytes32 s); |
| 452 | |
| 453 | /// Signs `digest` with signer provided to script using the secp256k1 curve. |
| 454 | /// Raises error if none of the signers passed into the script have provided address. |
| 455 | function sign(address signer, bytes32 digest) external pure returns (uint8 v, bytes32 r, bytes32 s); |
| 456 | |
| 457 | // ======== Environment ======== |
| 458 | |
| 459 | /// Gets the environment variable `name` and parses it as `address`. |
| 460 | /// Reverts if the variable was not found or could not be parsed. |
| 461 | function envAddress(string calldata name) external view returns (address value); |
| 462 | |
| 463 | /// Gets the environment variable `name` and parses it as an array of `address`, delimited by `delim`. |
| 464 | /// Reverts if the variable was not found or could not be parsed. |
| 465 | function envAddress(string calldata name, string calldata delim) external view returns (address[] memory value); |
| 466 | |
| 467 | /// Gets the environment variable `name` and parses it as `bool`. |
| 468 | /// Reverts if the variable was not found or could not be parsed. |
| 469 | function envBool(string calldata name) external view returns (bool value); |
| 470 | |
| 471 | /// Gets the environment variable `name` and parses it as an array of `bool`, delimited by `delim`. |
| 472 | /// Reverts if the variable was not found or could not be parsed. |
| 473 | function envBool(string calldata name, string calldata delim) external view returns (bool[] memory value); |
| 474 | |
| 475 | /// Gets the environment variable `name` and parses it as `bytes32`. |
| 476 | /// Reverts if the variable was not found or could not be parsed. |
| 477 | function envBytes32(string calldata name) external view returns (bytes32 value); |
| 478 | |
| 479 | /// Gets the environment variable `name` and parses it as an array of `bytes32`, delimited by `delim`. |
| 480 | /// Reverts if the variable was not found or could not be parsed. |
| 481 | function envBytes32(string calldata name, string calldata delim) external view returns (bytes32[] memory value); |
| 482 | |
| 483 | /// Gets the environment variable `name` and parses it as `bytes`. |
| 484 | /// Reverts if the variable was not found or could not be parsed. |
| 485 | function envBytes(string calldata name) external view returns (bytes memory value); |
| 486 | |
| 487 | /// Gets the environment variable `name` and parses it as an array of `bytes`, delimited by `delim`. |
| 488 | /// Reverts if the variable was not found or could not be parsed. |
| 489 | function envBytes(string calldata name, string calldata delim) external view returns (bytes[] memory value); |
| 490 | |
| 491 | /// Gets the environment variable `name` and returns true if it exists, else returns false. |
| 492 | function envExists(string calldata name) external view returns (bool result); |
| 493 | |
| 494 | /// Gets the environment variable `name` and parses it as `int256`. |
| 495 | /// Reverts if the variable was not found or could not be parsed. |
| 496 | function envInt(string calldata name) external view returns (int256 value); |
| 497 | |
| 498 | /// Gets the environment variable `name` and parses it as an array of `int256`, delimited by `delim`. |
| 499 | /// Reverts if the variable was not found or could not be parsed. |
| 500 | function envInt(string calldata name, string calldata delim) external view returns (int256[] memory value); |
| 501 | |
| 502 | /// Gets the environment variable `name` and parses it as `bool`. |
| 503 | /// Reverts if the variable could not be parsed. |
| 504 | /// Returns `defaultValue` if the variable was not found. |
| 505 | function envOr(string calldata name, bool defaultValue) external view returns (bool value); |
| 506 | |
| 507 | /// Gets the environment variable `name` and parses it as `uint256`. |
| 508 | /// Reverts if the variable could not be parsed. |
| 509 | /// Returns `defaultValue` if the variable was not found. |
| 510 | function envOr(string calldata name, uint256 defaultValue) external view returns (uint256 value); |
| 511 | |
| 512 | /// Gets the environment variable `name` and parses it as an array of `address`, delimited by `delim`. |
| 513 | /// Reverts if the variable could not be parsed. |
| 514 | /// Returns `defaultValue` if the variable was not found. |
| 515 | function envOr(string calldata name, string calldata delim, address[] calldata defaultValue) |
| 516 | external |
| 517 | view |
| 518 | returns (address[] memory value); |
| 519 | |
| 520 | /// Gets the environment variable `name` and parses it as an array of `bytes32`, delimited by `delim`. |
| 521 | /// Reverts if the variable could not be parsed. |
| 522 | /// Returns `defaultValue` if the variable was not found. |
| 523 | function envOr(string calldata name, string calldata delim, bytes32[] calldata defaultValue) |
| 524 | external |
| 525 | view |
| 526 | returns (bytes32[] memory value); |
| 527 | |
| 528 | /// Gets the environment variable `name` and parses it as an array of `string`, delimited by `delim`. |
| 529 | /// Reverts if the variable could not be parsed. |
| 530 | /// Returns `defaultValue` if the variable was not found. |
| 531 | function envOr(string calldata name, string calldata delim, string[] calldata defaultValue) |
| 532 | external |
| 533 | view |
| 534 | returns (string[] memory value); |
| 535 | |
| 536 | /// Gets the environment variable `name` and parses it as an array of `bytes`, delimited by `delim`. |
| 537 | /// Reverts if the variable could not be parsed. |
| 538 | /// Returns `defaultValue` if the variable was not found. |
| 539 | function envOr(string calldata name, string calldata delim, bytes[] calldata defaultValue) |
| 540 | external |
| 541 | view |
| 542 | returns (bytes[] memory value); |
| 543 | |
| 544 | /// Gets the environment variable `name` and parses it as `int256`. |
| 545 | /// Reverts if the variable could not be parsed. |
| 546 | /// Returns `defaultValue` if the variable was not found. |
| 547 | function envOr(string calldata name, int256 defaultValue) external view returns (int256 value); |
| 548 | |
| 549 | /// Gets the environment variable `name` and parses it as `address`. |
| 550 | /// Reverts if the variable could not be parsed. |
| 551 | /// Returns `defaultValue` if the variable was not found. |
| 552 | function envOr(string calldata name, address defaultValue) external view returns (address value); |
| 553 | |
| 554 | /// Gets the environment variable `name` and parses it as `bytes32`. |
| 555 | /// Reverts if the variable could not be parsed. |
| 556 | /// Returns `defaultValue` if the variable was not found. |
| 557 | function envOr(string calldata name, bytes32 defaultValue) external view returns (bytes32 value); |
| 558 | |
| 559 | /// Gets the environment variable `name` and parses it as `string`. |
| 560 | /// Reverts if the variable could not be parsed. |
| 561 | /// Returns `defaultValue` if the variable was not found. |
| 562 | function envOr(string calldata name, string calldata defaultValue) external view returns (string memory value); |
| 563 | |
| 564 | /// Gets the environment variable `name` and parses it as `bytes`. |
| 565 | /// Reverts if the variable could not be parsed. |
| 566 | /// Returns `defaultValue` if the variable was not found. |
| 567 | function envOr(string calldata name, bytes calldata defaultValue) external view returns (bytes memory value); |
| 568 | |
| 569 | /// Gets the environment variable `name` and parses it as an array of `bool`, delimited by `delim`. |
| 570 | /// Reverts if the variable could not be parsed. |
| 571 | /// Returns `defaultValue` if the variable was not found. |
| 572 | function envOr(string calldata name, string calldata delim, bool[] calldata defaultValue) |
| 573 | external |
| 574 | view |
| 575 | returns (bool[] memory value); |
| 576 | |
| 577 | /// Gets the environment variable `name` and parses it as an array of `uint256`, delimited by `delim`. |
| 578 | /// Reverts if the variable could not be parsed. |
| 579 | /// Returns `defaultValue` if the variable was not found. |
| 580 | function envOr(string calldata name, string calldata delim, uint256[] calldata defaultValue) |
| 581 | external |
| 582 | view |
| 583 | returns (uint256[] memory value); |
| 584 | |
| 585 | /// Gets the environment variable `name` and parses it as an array of `int256`, delimited by `delim`. |
| 586 | /// Reverts if the variable could not be parsed. |
| 587 | /// Returns `defaultValue` if the variable was not found. |
| 588 | function envOr(string calldata name, string calldata delim, int256[] calldata defaultValue) |
| 589 | external |
| 590 | view |
| 591 | returns (int256[] memory value); |
| 592 | |
| 593 | /// Gets the environment variable `name` and parses it as `string`. |
| 594 | /// Reverts if the variable was not found or could not be parsed. |
| 595 | function envString(string calldata name) external view returns (string memory value); |
| 596 | |
| 597 | /// Gets the environment variable `name` and parses it as an array of `string`, delimited by `delim`. |
| 598 | /// Reverts if the variable was not found or could not be parsed. |
| 599 | function envString(string calldata name, string calldata delim) external view returns (string[] memory value); |
| 600 | |
| 601 | /// Gets the environment variable `name` and parses it as `uint256`. |
| 602 | /// Reverts if the variable was not found or could not be parsed. |
| 603 | function envUint(string calldata name) external view returns (uint256 value); |
| 604 | |
| 605 | /// Gets the environment variable `name` and parses it as an array of `uint256`, delimited by `delim`. |
| 606 | /// Reverts if the variable was not found or could not be parsed. |
| 607 | function envUint(string calldata name, string calldata delim) external view returns (uint256[] memory value); |
| 608 | |
| 609 | /// Returns true if `forge` command was executed in given context. |
| 610 | function isContext(ForgeContext context) external view returns (bool result); |
| 611 | |
| 612 | /// Resolves the env variable placeholders of a given input string. |
| 613 | function resolveEnv(string calldata input) external returns (string memory); |
| 614 | |
| 615 | /// Sets environment variables. |
| 616 | function setEnv(string calldata name, string calldata value) external; |
| 617 | |
| 618 | // ======== EVM ======== |
| 619 | |
| 620 | /// Gets all accessed reads and write slot from a `vm.record` session, for a given address. |
| 621 | function accesses(address target) external view returns (bytes32[] memory readSlots, bytes32[] memory writeSlots); |
| 622 | |
| 623 | /// Gets the address for a given private key. |
| 624 | function addr(uint256 privateKey) external pure returns (address keyAddr); |
| 625 | |
| 626 | /// Gets all the logs according to specified filter. |
| 627 | function eth_getLogs(uint256 fromBlock, uint256 toBlock, address target, bytes32[] calldata topics) |
| 628 | external |
| 629 | view |
| 630 | returns (EthGetLogs[] memory logs); |
| 631 | |
| 632 | /// Gets the current `block.blobbasefee`. |
| 633 | /// You should use this instead of `block.blobbasefee` if you use `vm.blobBaseFee`, as `block.blobbasefee` is assumed to be constant across a transaction, |
| 634 | /// and as a result will get optimized out by the compiler. |
| 635 | /// See https://github.com/foundry-rs/foundry/issues/6180 |
| 636 | function getBlobBaseFee() external view returns (uint256 blobBaseFee); |
| 637 | |
| 638 | /// Gets the current `block.number`. |
| 639 | /// You should use this instead of `block.number` if you use `vm.roll`, as `block.number` is assumed to be constant across a transaction, |
| 640 | /// and as a result will get optimized out by the compiler. |
| 641 | /// See https://github.com/foundry-rs/foundry/issues/6180 |
| 642 | function getBlockNumber() external view returns (uint256 height); |
| 643 | |
| 644 | /// Gets the current `block.timestamp`. |
| 645 | /// You should use this instead of `block.timestamp` if you use `vm.warp`, as `block.timestamp` is assumed to be constant across a transaction, |
| 646 | /// and as a result will get optimized out by the compiler. |
| 647 | /// See https://github.com/foundry-rs/foundry/issues/6180 |
| 648 | function getBlockTimestamp() external view returns (uint256 timestamp); |
| 649 | |
| 650 | /// Gets the current `block.chainid` of the currently selected environment. |
| 651 | /// You should use this instead of `block.chainid` if you use `vm.selectFork` or `vm.createSelectFork`, as `block.chainid` could be assumed |
| 652 | /// to be constant across a transaction, and as a result will get optimized out by the compiler. |
| 653 | /// See https://github.com/foundry-rs/foundry/issues/6180 |
| 654 | function getChainId() external view returns (uint256 blockChainId); |
| 655 | |
| 656 | /// Returns the test or script execution evm version. |
| 657 | /// **Note:** The execution evm version is not the same as the compilation one. |
| 658 | function getEvmVersion() external pure returns (string memory evm); |
| 659 | |
| 660 | /// Gets the map key and parent of a mapping at a given slot, for a given address. |
| 661 | function getMappingKeyAndParentOf(address target, bytes32 elementSlot) |
| 662 | external |
| 663 | view |
| 664 | returns (bool found, bytes32 key, bytes32 parent); |
| 665 | |
| 666 | /// Gets the number of elements in the mapping at the given slot, for a given address. |
| 667 | function getMappingLength(address target, bytes32 mappingSlot) external view returns (uint256 length); |
| 668 | |
| 669 | /// Gets the elements at index idx of the mapping at the given slot, for a given address. The |
| 670 | /// index must be less than the length of the mapping (i.e. the number of keys in the mapping). |
| 671 | function getMappingSlotAt(address target, bytes32 mappingSlot, uint256 idx) external view returns (bytes32 value); |
| 672 | |
| 673 | /// Gets the nonce of an account. |
| 674 | function getNonce(address account) external view returns (uint64 nonce); |
| 675 | |
| 676 | /// Get the nonce of a `Wallet`. |
| 677 | function getNonce(Wallet calldata wallet) external view returns (uint64 nonce); |
| 678 | |
| 679 | /// Gets the RLP encoded block header for a given block number. |
| 680 | /// Returns the block header in the same format as `cast block <block_number> --raw`. |
| 681 | function getRawBlockHeader(uint256 blockNumber) external view returns (bytes memory rlpHeader); |
| 682 | |
| 683 | /// Gets all the recorded logs. |
| 684 | function getRecordedLogs() external view returns (Log[] memory logs); |
| 685 | |
| 686 | /// Returns state diffs from current `vm.startStateDiffRecording` session. |
| 687 | function getStateDiff() external view returns (string memory diff); |
| 688 | |
| 689 | /// Returns state diffs from current `vm.startStateDiffRecording` session, in json format. |
| 690 | function getStateDiffJson() external view returns (string memory diff); |
| 691 | |
| 692 | /// Returns an array of `StorageAccess` from current `vm.stateStateDiffRecording` session |
| 693 | function getStorageAccesses() external view returns (StorageAccess[] memory storageAccesses); |
| 694 | |
| 695 | /// Returns an array of storage slots occupied by the specified variable. |
| 696 | function getStorageSlots(address target, string calldata variableName) |
| 697 | external |
| 698 | view |
| 699 | returns (uint256[] memory slots); |
| 700 | |
| 701 | /// Gets the gas used in the last call from the callee perspective. |
| 702 | function lastCallGas() external view returns (Gas memory gas); |
| 703 | |
| 704 | /// Loads a storage slot from an address. |
| 705 | function load(address target, bytes32 slot) external view returns (bytes32 data); |
| 706 | |
| 707 | /// Pauses gas metering (i.e. gas usage is not counted). Noop if already paused. |
| 708 | function pauseGasMetering() external; |
| 709 | |
| 710 | /// Records all storage reads and writes. Use `accesses` to get the recorded data. |
| 711 | /// Subsequent calls to `record` will clear the previous data. |
| 712 | function record() external; |
| 713 | |
| 714 | /// Record all the transaction logs. |
| 715 | function recordLogs() external; |
| 716 | |
| 717 | /// Reset gas metering (i.e. gas usage is set to gas limit). |
| 718 | function resetGasMetering() external; |
| 719 | |
| 720 | /// Resumes gas metering (i.e. gas usage is counted again). Noop if already on. |
| 721 | function resumeGasMetering() external; |
| 722 | |
| 723 | /// Performs an Ethereum JSON-RPC request to the current fork URL. |
| 724 | function rpc(string calldata method, string calldata params) external returns (bytes memory data); |
| 725 | |
| 726 | /// Performs an Ethereum JSON-RPC request to the given endpoint. |
| 727 | function rpc(string calldata urlOrAlias, string calldata method, string calldata params) |
| 728 | external |
| 729 | returns (bytes memory data); |
| 730 | |
| 731 | /// Set the exact test or script execution evm version, e.g. `berlin`, `cancun`. |
| 732 | /// **Note:** The execution evm version is not the same as the compilation one. |
| 733 | function setEvmVersion(string calldata evm) external; |
| 734 | |
| 735 | /// Records the debug trace during the run. |
| 736 | function startDebugTraceRecording() external; |
| 737 | |
| 738 | /// Starts recording all map SSTOREs for later retrieval. |
| 739 | function startMappingRecording() external; |
| 740 | |
| 741 | /// Record all account accesses as part of CREATE, CALL or SELFDESTRUCT opcodes in order, |
| 742 | /// along with the context of the calls |
| 743 | function startStateDiffRecording() external; |
| 744 | |
| 745 | /// Stop debug trace recording and returns the recorded debug trace. |
| 746 | function stopAndReturnDebugTraceRecording() external returns (DebugStep[] memory step); |
| 747 | |
| 748 | /// Returns an ordered array of all account accesses from a `vm.startStateDiffRecording` session. |
| 749 | function stopAndReturnStateDiff() external returns (AccountAccess[] memory accountAccesses); |
| 750 | |
| 751 | /// Stops recording all map SSTOREs for later retrieval and clears the recorded data. |
| 752 | function stopMappingRecording() external; |
| 753 | |
| 754 | /// Stops recording storage reads and writes. |
| 755 | function stopRecord() external; |
| 756 | |
| 757 | // ======== Filesystem ======== |
| 758 | |
| 759 | /// Closes file for reading, resetting the offset and allowing to read it from beginning with readLine. |
| 760 | /// `path` is relative to the project root. |
| 761 | function closeFile(string calldata path) external; |
| 762 | |
| 763 | /// Copies the contents of one file to another. This function will **overwrite** the contents of `to`. |
| 764 | /// On success, the total number of bytes copied is returned and it is equal to the length of the `to` file as reported by `metadata`. |
| 765 | /// Both `from` and `to` are relative to the project root. |
| 766 | function copyFile(string calldata from, string calldata to) external returns (uint64 copied); |
| 767 | |
| 768 | /// Creates a new, empty directory at the provided path. |
| 769 | /// This cheatcode will revert in the following situations, but is not limited to just these cases: |
| 770 | /// - User lacks permissions to modify `path`. |
| 771 | /// - A parent of the given path doesn't exist and `recursive` is false. |
| 772 | /// - `path` already exists and `recursive` is false. |
| 773 | /// `path` is relative to the project root. |
| 774 | function createDir(string calldata path, bool recursive) external; |
| 775 | |
| 776 | /// Deploys a contract from an artifact file. Takes in the relative path to the json file or the path to the |
| 777 | /// artifact in the form of <path>:<contract>:<version> where <contract> and <version> parts are optional. |
| 778 | /// Reverts if the target artifact contains unlinked library placeholders. |
| 779 | function deployCode(string calldata artifactPath) external returns (address deployedAddress); |
| 780 | |
| 781 | /// Deploys a contract from an artifact file. Takes in the relative path to the json file or the path to the |
| 782 | /// artifact in the form of <path>:<contract>:<version> where <contract> and <version> parts are optional. |
| 783 | /// Reverts if the target artifact contains unlinked library placeholders. |
| 784 | /// Additionally accepts abi-encoded constructor arguments. |
| 785 | function deployCode(string calldata artifactPath, bytes calldata constructorArgs) |
| 786 | external |
| 787 | returns (address deployedAddress); |
| 788 | |
| 789 | /// Deploys a contract from an artifact file. Takes in the relative path to the json file or the path to the |
| 790 | /// artifact in the form of <path>:<contract>:<version> where <contract> and <version> parts are optional. |
| 791 | /// Reverts if the target artifact contains unlinked library placeholders. |
| 792 | /// Additionally accepts `msg.value`. |
| 793 | function deployCode(string calldata artifactPath, uint256 value) external returns (address deployedAddress); |
| 794 | |
| 795 | /// Deploys a contract from an artifact file. Takes in the relative path to the json file or the path to the |
| 796 | /// artifact in the form of <path>:<contract>:<version> where <contract> and <version> parts are optional. |
| 797 | /// Reverts if the target artifact contains unlinked library placeholders. |
| 798 | /// Additionally accepts abi-encoded constructor arguments and `msg.value`. |
| 799 | function deployCode(string calldata artifactPath, bytes calldata constructorArgs, uint256 value) |
| 800 | external |
| 801 | returns (address deployedAddress); |
| 802 | |
| 803 | /// Deploys a contract from an artifact file, using the CREATE2 salt. Takes in the relative path to the json file or the path to the |
| 804 | /// artifact in the form of <path>:<contract>:<version> where <contract> and <version> parts are optional. |
| 805 | /// Reverts if the target artifact contains unlinked library placeholders. |
| 806 | function deployCode(string calldata artifactPath, bytes32 salt) external returns (address deployedAddress); |
| 807 | |
| 808 | /// Deploys a contract from an artifact file, using the CREATE2 salt. Takes in the relative path to the json file or the path to the |
| 809 | /// artifact in the form of <path>:<contract>:<version> where <contract> and <version> parts are optional. |
| 810 | /// Reverts if the target artifact contains unlinked library placeholders. |
| 811 | /// Additionally accepts abi-encoded constructor arguments. |
| 812 | function deployCode(string calldata artifactPath, bytes calldata constructorArgs, bytes32 salt) |
| 813 | external |
| 814 | returns (address deployedAddress); |
| 815 | |
| 816 | /// Deploys a contract from an artifact file, using the CREATE2 salt. Takes in the relative path to the json file or the path to the |
| 817 | /// artifact in the form of <path>:<contract>:<version> where <contract> and <version> parts are optional. |
| 818 | /// Reverts if the target artifact contains unlinked library placeholders. |
| 819 | /// Additionally accepts `msg.value`. |
| 820 | function deployCode(string calldata artifactPath, uint256 value, bytes32 salt) |
| 821 | external |
| 822 | returns (address deployedAddress); |
| 823 | |
| 824 | /// Deploys a contract from an artifact file, using the CREATE2 salt. Takes in the relative path to the json file or the path to the |
| 825 | /// artifact in the form of <path>:<contract>:<version> where <contract> and <version> parts are optional. |
| 826 | /// Reverts if the target artifact contains unlinked library placeholders. |
| 827 | /// Additionally accepts abi-encoded constructor arguments and `msg.value`. |
| 828 | function deployCode(string calldata artifactPath, bytes calldata constructorArgs, uint256 value, bytes32 salt) |
| 829 | external |
| 830 | returns (address deployedAddress); |
| 831 | |
| 832 | /// Returns true if the given path points to an existing entity, else returns false. |
| 833 | function exists(string calldata path) external view returns (bool result); |
| 834 | |
| 835 | /// Performs a foreign function call via the terminal. |
| 836 | function ffi(string[] calldata commandInput) external returns (bytes memory result); |
| 837 | |
| 838 | /// Given a path, query the file system to get information about a file, directory, etc. |
| 839 | function fsMetadata(string calldata path) external view returns (FsMetadata memory metadata); |
| 840 | |
| 841 | /// Gets the artifact path from code (aka. creation code). |
| 842 | function getArtifactPathByCode(bytes calldata code) external view returns (string memory path); |
| 843 | |
| 844 | /// Gets the artifact path from deployed code (aka. runtime code). |
| 845 | function getArtifactPathByDeployedCode(bytes calldata deployedCode) external view returns (string memory path); |
| 846 | |
| 847 | /// Returns the most recent broadcast for the given contract on `chainId` matching `txType`. |
| 848 | /// For example: |
| 849 | /// The most recent deployment can be fetched by passing `txType` as `CREATE` or `CREATE2`. |
| 850 | /// The most recent call can be fetched by passing `txType` as `CALL`. |
| 851 | function getBroadcast(string calldata contractName, uint64 chainId, BroadcastTxType txType) |
| 852 | external |
| 853 | view |
| 854 | returns (BroadcastTxSummary memory); |
| 855 | |
| 856 | /// Returns all broadcasts for the given contract on `chainId` with the specified `txType`. |
| 857 | /// Sorted such that the most recent broadcast is the first element, and the oldest is the last. i.e descending order of BroadcastTxSummary.blockNumber. |
| 858 | function getBroadcasts(string calldata contractName, uint64 chainId, BroadcastTxType txType) |
| 859 | external |
| 860 | view |
| 861 | returns (BroadcastTxSummary[] memory); |
| 862 | |
| 863 | /// Returns all broadcasts for the given contract on `chainId`. |
| 864 | /// Sorted such that the most recent broadcast is the first element, and the oldest is the last. i.e descending order of BroadcastTxSummary.blockNumber. |
| 865 | function getBroadcasts(string calldata contractName, uint64 chainId) |
| 866 | external |
| 867 | view |
| 868 | returns (BroadcastTxSummary[] memory); |
| 869 | |
| 870 | /// Gets the creation bytecode from an artifact file. Takes in the relative path to the json file or the path to the |
| 871 | /// artifact in the form of <path>:<contract>:<version> where <contract> and <version> parts are optional. |
| 872 | function getCode(string calldata artifactPath) external view returns (bytes memory creationBytecode); |
| 873 | |
| 874 | /// Gets the deployed bytecode from an artifact file. Takes in the relative path to the json file or the path to the |
| 875 | /// artifact in the form of <path>:<contract>:<version> where <contract> and <version> parts are optional. |
| 876 | function getDeployedCode(string calldata artifactPath) external view returns (bytes memory runtimeBytecode); |
| 877 | |
| 878 | /// Returns the most recent deployment for the current `chainId`. |
| 879 | function getDeployment(string calldata contractName) external view returns (address deployedAddress); |
| 880 | |
| 881 | /// Returns the most recent deployment for the given contract on `chainId` |
| 882 | function getDeployment(string calldata contractName, uint64 chainId) external view returns (address deployedAddress); |
| 883 | |
| 884 | /// Returns all deployments for the given contract on `chainId` |
| 885 | /// Sorted in descending order of deployment time i.e descending order of BroadcastTxSummary.blockNumber. |
| 886 | /// The most recent deployment is the first element, and the oldest is the last. |
| 887 | function getDeployments(string calldata contractName, uint64 chainId) |
| 888 | external |
| 889 | view |
| 890 | returns (address[] memory deployedAddresses); |
| 891 | |
| 892 | /// Returns true if the path exists on disk and is pointing at a directory, else returns false. |
| 893 | function isDir(string calldata path) external view returns (bool result); |
| 894 | |
| 895 | /// Returns true if the path exists on disk and is pointing at a regular file, else returns false. |
| 896 | function isFile(string calldata path) external view returns (bool result); |
| 897 | |
| 898 | /// Get the path of the current project root. |
| 899 | function projectRoot() external view returns (string memory path); |
| 900 | |
| 901 | /// Prompts the user for a string value in the terminal. |
| 902 | function prompt(string calldata promptText) external returns (string memory input); |
| 903 | |
| 904 | /// Prompts the user for an address in the terminal. |
| 905 | function promptAddress(string calldata promptText) external returns (address); |
| 906 | |
| 907 | /// Prompts the user for a hidden string value in the terminal. |
| 908 | function promptSecret(string calldata promptText) external returns (string memory input); |
| 909 | |
| 910 | /// Prompts the user for hidden uint256 in the terminal (usually pk). |
| 911 | function promptSecretUint(string calldata promptText) external returns (uint256); |
| 912 | |
| 913 | /// Prompts the user for uint256 in the terminal. |
| 914 | function promptUint(string calldata promptText) external returns (uint256); |
| 915 | |
| 916 | /// Reads the directory at the given path recursively, up to `maxDepth`. |
| 917 | /// `maxDepth` defaults to 1, meaning only the direct children of the given directory will be returned. |
| 918 | /// Follows symbolic links if `followLinks` is true. |
| 919 | function readDir(string calldata path) external view returns (DirEntry[] memory entries); |
| 920 | |
| 921 | /// See `readDir(string)`. |
| 922 | function readDir(string calldata path, uint64 maxDepth) external view returns (DirEntry[] memory entries); |
| 923 | |
| 924 | /// See `readDir(string)`. |
| 925 | function readDir(string calldata path, uint64 maxDepth, bool followLinks) |
| 926 | external |
| 927 | view |
| 928 | returns (DirEntry[] memory entries); |
| 929 | |
| 930 | /// Reads the entire content of file to string. `path` is relative to the project root. |
| 931 | function readFile(string calldata path) external view returns (string memory data); |
| 932 | |
| 933 | /// Reads the entire content of file as binary. `path` is relative to the project root. |
| 934 | function readFileBinary(string calldata path) external view returns (bytes memory data); |
| 935 | |
| 936 | /// Reads next line of file to string. |
| 937 | function readLine(string calldata path) external view returns (string memory line); |
| 938 | |
| 939 | /// Reads a symbolic link, returning the path that the link points to. |
| 940 | /// This cheatcode will revert in the following situations, but is not limited to just these cases: |
| 941 | /// - `path` is not a symbolic link. |
| 942 | /// - `path` does not exist. |
| 943 | function readLink(string calldata linkPath) external view returns (string memory targetPath); |
| 944 | |
| 945 | /// Removes a directory at the provided path. |
| 946 | /// This cheatcode will revert in the following situations, but is not limited to just these cases: |
| 947 | /// - `path` doesn't exist. |
| 948 | /// - `path` isn't a directory. |
| 949 | /// - User lacks permissions to modify `path`. |
| 950 | /// - The directory is not empty and `recursive` is false. |
| 951 | /// `path` is relative to the project root. |
| 952 | function removeDir(string calldata path, bool recursive) external; |
| 953 | |
| 954 | /// Removes a file from the filesystem. |
| 955 | /// This cheatcode will revert in the following situations, but is not limited to just these cases: |
| 956 | /// - `path` points to a directory. |
| 957 | /// - The file doesn't exist. |
| 958 | /// - The user lacks permissions to remove the file. |
| 959 | /// `path` is relative to the project root. |
| 960 | function removeFile(string calldata path) external; |
| 961 | |
| 962 | /// Performs a foreign function call via terminal and returns the exit code, stdout, and stderr. |
| 963 | function tryFfi(string[] calldata commandInput) external returns (FfiResult memory result); |
| 964 | |
| 965 | /// Returns the time since unix epoch in milliseconds. |
| 966 | function unixTime() external view returns (uint256 milliseconds); |
| 967 | |
| 968 | /// Writes data to file, creating a file if it does not exist, and entirely replacing its contents if it does. |
| 969 | /// `path` is relative to the project root. |
| 970 | function writeFile(string calldata path, string calldata data) external; |
| 971 | |
| 972 | /// Writes binary data to a file, creating a file if it does not exist, and entirely replacing its contents if it does. |
| 973 | /// `path` is relative to the project root. |
| 974 | function writeFileBinary(string calldata path, bytes calldata data) external; |
| 975 | |
| 976 | /// Writes line to file, creating a file if it does not exist. |
| 977 | /// `path` is relative to the project root. |
| 978 | function writeLine(string calldata path, string calldata data) external; |
| 979 | |
| 980 | // ======== JSON ======== |
| 981 | |
| 982 | /// Checks if `key` exists in a JSON object. |
| 983 | function keyExistsJson(string calldata json, string calldata key) external view returns (bool); |
| 984 | |
| 985 | /// Parses a string of JSON data at `key` and coerces it to `address`. |
| 986 | function parseJsonAddress(string calldata json, string calldata key) external pure returns (address); |
| 987 | |
| 988 | /// Parses a string of JSON data at `key` and coerces it to `address[]`. |
| 989 | function parseJsonAddressArray(string calldata json, string calldata key) external pure returns (address[] memory); |
| 990 | |
| 991 | /// Parses a string of JSON data at `key` and coerces it to `bool`. |
| 992 | function parseJsonBool(string calldata json, string calldata key) external pure returns (bool); |
| 993 | |
| 994 | /// Parses a string of JSON data at `key` and coerces it to `bool[]`. |
| 995 | function parseJsonBoolArray(string calldata json, string calldata key) external pure returns (bool[] memory); |
| 996 | |
| 997 | /// Parses a string of JSON data at `key` and coerces it to `bytes`. |
| 998 | function parseJsonBytes(string calldata json, string calldata key) external pure returns (bytes memory); |
| 999 | |
| 1000 | /// Parses a string of JSON data at `key` and coerces it to `bytes32`. |
| 1001 | function parseJsonBytes32(string calldata json, string calldata key) external pure returns (bytes32); |
| 1002 | |
| 1003 | /// Parses a string of JSON data at `key` and coerces it to `bytes32[]`. |
| 1004 | function parseJsonBytes32Array(string calldata json, string calldata key) external pure returns (bytes32[] memory); |
| 1005 | |
| 1006 | /// Parses a string of JSON data at `key` and coerces it to `bytes[]`. |
| 1007 | function parseJsonBytesArray(string calldata json, string calldata key) external pure returns (bytes[] memory); |
| 1008 | |
| 1009 | /// Parses a string of JSON data at `key` and coerces it to `int256`. |
| 1010 | function parseJsonInt(string calldata json, string calldata key) external pure returns (int256); |
| 1011 | |
| 1012 | /// Parses a string of JSON data at `key` and coerces it to `int256[]`. |
| 1013 | function parseJsonIntArray(string calldata json, string calldata key) external pure returns (int256[] memory); |
| 1014 | |
| 1015 | /// Returns an array of all the keys in a JSON object. |
| 1016 | function parseJsonKeys(string calldata json, string calldata key) external pure returns (string[] memory keys); |
| 1017 | |
| 1018 | /// Parses a string of JSON data at `key` and coerces it to `string`. |
| 1019 | function parseJsonString(string calldata json, string calldata key) external pure returns (string memory); |
| 1020 | |
| 1021 | /// Parses a string of JSON data at `key` and coerces it to `string[]`. |
| 1022 | function parseJsonStringArray(string calldata json, string calldata key) external pure returns (string[] memory); |
| 1023 | |
| 1024 | /// Parses a string of JSON data at `key` and coerces it to type array corresponding to `typeDescription`. |
| 1025 | function parseJsonTypeArray(string calldata json, string calldata key, string calldata typeDescription) |
| 1026 | external |
| 1027 | pure |
| 1028 | returns (bytes memory); |
| 1029 | |
| 1030 | /// Parses a string of JSON data and coerces it to type corresponding to `typeDescription`. |
| 1031 | function parseJsonType(string calldata json, string calldata typeDescription) external pure returns (bytes memory); |
| 1032 | |
| 1033 | /// Parses a string of JSON data at `key` and coerces it to type corresponding to `typeDescription`. |
| 1034 | function parseJsonType(string calldata json, string calldata key, string calldata typeDescription) |
| 1035 | external |
| 1036 | pure |
| 1037 | returns (bytes memory); |
| 1038 | |
| 1039 | /// Parses a string of JSON data at `key` and coerces it to `uint256`. |
| 1040 | function parseJsonUint(string calldata json, string calldata key) external pure returns (uint256); |
| 1041 | |
| 1042 | /// Parses a string of JSON data at `key` and coerces it to `uint256[]`. |
| 1043 | function parseJsonUintArray(string calldata json, string calldata key) external pure returns (uint256[] memory); |
| 1044 | |
| 1045 | /// ABI-encodes a JSON object. |
| 1046 | function parseJson(string calldata json) external pure returns (bytes memory abiEncodedData); |
| 1047 | |
| 1048 | /// ABI-encodes a JSON object at `key`. |
| 1049 | function parseJson(string calldata json, string calldata key) external pure returns (bytes memory abiEncodedData); |
| 1050 | |
| 1051 | /// See `serializeJson`. |
| 1052 | function serializeAddress(string calldata objectKey, string calldata valueKey, address value) |
| 1053 | external |
| 1054 | returns (string memory json); |
| 1055 | |
| 1056 | /// See `serializeJson`. |
| 1057 | function serializeAddress(string calldata objectKey, string calldata valueKey, address[] calldata values) |
| 1058 | external |
| 1059 | returns (string memory json); |
| 1060 | |
| 1061 | /// See `serializeJson`. |
| 1062 | function serializeBool(string calldata objectKey, string calldata valueKey, bool value) |
| 1063 | external |
| 1064 | returns (string memory json); |
| 1065 | |
| 1066 | /// See `serializeJson`. |
| 1067 | function serializeBool(string calldata objectKey, string calldata valueKey, bool[] calldata values) |
| 1068 | external |
| 1069 | returns (string memory json); |
| 1070 | |
| 1071 | /// See `serializeJson`. |
| 1072 | function serializeBytes32(string calldata objectKey, string calldata valueKey, bytes32 value) |
| 1073 | external |
| 1074 | returns (string memory json); |
| 1075 | |
| 1076 | /// See `serializeJson`. |
| 1077 | function serializeBytes32(string calldata objectKey, string calldata valueKey, bytes32[] calldata values) |
| 1078 | external |
| 1079 | returns (string memory json); |
| 1080 | |
| 1081 | /// See `serializeJson`. |
| 1082 | function serializeBytes(string calldata objectKey, string calldata valueKey, bytes calldata value) |
| 1083 | external |
| 1084 | returns (string memory json); |
| 1085 | |
| 1086 | /// See `serializeJson`. |
| 1087 | function serializeBytes(string calldata objectKey, string calldata valueKey, bytes[] calldata values) |
| 1088 | external |
| 1089 | returns (string memory json); |
| 1090 | |
| 1091 | /// See `serializeJson`. |
| 1092 | function serializeInt(string calldata objectKey, string calldata valueKey, int256 value) |
| 1093 | external |
| 1094 | returns (string memory json); |
| 1095 | |
| 1096 | /// See `serializeJson`. |
| 1097 | function serializeInt(string calldata objectKey, string calldata valueKey, int256[] calldata values) |
| 1098 | external |
| 1099 | returns (string memory json); |
| 1100 | |
| 1101 | /// Serializes a key and value to a JSON object stored in-memory that can be later written to a file. |
| 1102 | /// Returns the stringified version of the specific JSON file up to that moment. |
| 1103 | function serializeJson(string calldata objectKey, string calldata value) external returns (string memory json); |
| 1104 | |
| 1105 | /// See `serializeJson`. |
| 1106 | function serializeJsonType(string calldata typeDescription, bytes calldata value) |
| 1107 | external |
| 1108 | pure |
| 1109 | returns (string memory json); |
| 1110 | |
| 1111 | /// See `serializeJson`. |
| 1112 | function serializeJsonType( |
| 1113 | string calldata objectKey, |
| 1114 | string calldata valueKey, |
| 1115 | string calldata typeDescription, |
| 1116 | bytes calldata value |
| 1117 | ) external returns (string memory json); |
| 1118 | |
| 1119 | /// See `serializeJson`. |
| 1120 | function serializeString(string calldata objectKey, string calldata valueKey, string calldata value) |
| 1121 | external |
| 1122 | returns (string memory json); |
| 1123 | |
| 1124 | /// See `serializeJson`. |
| 1125 | function serializeString(string calldata objectKey, string calldata valueKey, string[] calldata values) |
| 1126 | external |
| 1127 | returns (string memory json); |
| 1128 | |
| 1129 | /// See `serializeJson`. |
| 1130 | function serializeUintToHex(string calldata objectKey, string calldata valueKey, uint256 value) |
| 1131 | external |
| 1132 | returns (string memory json); |
| 1133 | |
| 1134 | /// See `serializeJson`. |
| 1135 | function serializeUint(string calldata objectKey, string calldata valueKey, uint256 value) |
| 1136 | external |
| 1137 | returns (string memory json); |
| 1138 | |
| 1139 | /// See `serializeJson`. |
| 1140 | function serializeUint(string calldata objectKey, string calldata valueKey, uint256[] calldata values) |
| 1141 | external |
| 1142 | returns (string memory json); |
| 1143 | |
| 1144 | /// Write a serialized JSON object to a file. If the file exists, it will be overwritten. |
| 1145 | function writeJson(string calldata json, string calldata path) external; |
| 1146 | |
| 1147 | /// Write a serialized JSON object to an **existing** JSON file, replacing a value with key = <value_key.> |
| 1148 | /// This is useful to replace a specific value of a JSON file, without having to parse the entire thing. |
| 1149 | /// This cheatcode will create new keys if they didn't previously exist. |
| 1150 | function writeJson(string calldata json, string calldata path, string calldata valueKey) external; |
| 1151 | |
| 1152 | /// Checks if `key` exists in a JSON object |
| 1153 | /// `keyExists` is being deprecated in favor of `keyExistsJson`. It will be removed in future versions. |
| 1154 | function keyExists(string calldata json, string calldata key) external view returns (bool); |
| 1155 | |
| 1156 | // ======== Scripting ======== |
| 1157 | |
| 1158 | /// Attach an EIP-4844 blob to the next call |
| 1159 | function attachBlob(bytes calldata blob) external; |
| 1160 | |
| 1161 | /// Designate the next call as an EIP-7702 transaction |
| 1162 | function attachDelegation(SignedDelegation calldata signedDelegation) external; |
| 1163 | |
| 1164 | /// Designate the next call as an EIP-7702 transaction, with optional cross-chain validity. |
| 1165 | function attachDelegation(SignedDelegation calldata signedDelegation, bool crossChain) external; |
| 1166 | |
| 1167 | /// Takes a signed transaction and broadcasts it to the network. |
| 1168 | function broadcastRawTransaction(bytes calldata data) external; |
| 1169 | |
| 1170 | /// Has the next call (at this call depth only) create transactions that can later be signed and sent onchain. |
| 1171 | /// Broadcasting address is determined by checking the following in order: |
| 1172 | /// 1. If `--sender` argument was provided, that address is used. |
| 1173 | /// 2. If exactly one signer (e.g. private key, hw wallet, keystore) is set when `forge broadcast` is invoked, that signer is used. |
| 1174 | /// 3. Otherwise, default foundry sender (1804c8AB1F12E6bbf3894d4083f33e07309d1f38) is used. |
| 1175 | function broadcast() external; |
| 1176 | |
| 1177 | /// Has the next call (at this call depth only) create a transaction with the address provided |
| 1178 | /// as the sender that can later be signed and sent onchain. |
| 1179 | function broadcast(address signer) external; |
| 1180 | |
| 1181 | /// Has the next call (at this call depth only) create a transaction with the private key |
| 1182 | /// provided as the sender that can later be signed and sent onchain. |
| 1183 | function broadcast(uint256 privateKey) external; |
| 1184 | |
| 1185 | /// Returns addresses of available unlocked wallets in the script environment. |
| 1186 | function getWallets() external view returns (address[] memory wallets); |
| 1187 | |
| 1188 | /// Sign an EIP-7702 authorization and designate the next call as an EIP-7702 transaction |
| 1189 | function signAndAttachDelegation(address implementation, uint256 privateKey) |
| 1190 | external |
| 1191 | returns (SignedDelegation memory signedDelegation); |
| 1192 | |
| 1193 | /// Sign an EIP-7702 authorization and designate the next call as an EIP-7702 transaction for specific nonce |
| 1194 | function signAndAttachDelegation(address implementation, uint256 privateKey, uint64 nonce) |
| 1195 | external |
| 1196 | returns (SignedDelegation memory signedDelegation); |
| 1197 | |
| 1198 | /// Sign an EIP-7702 authorization and designate the next call as an EIP-7702 transaction, with optional cross-chain validity. |
| 1199 | function signAndAttachDelegation(address implementation, uint256 privateKey, bool crossChain) |
| 1200 | external |
| 1201 | returns (SignedDelegation memory signedDelegation); |
| 1202 | |
| 1203 | /// Sign an EIP-7702 authorization for delegation |
| 1204 | function signDelegation(address implementation, uint256 privateKey) |
| 1205 | external |
| 1206 | returns (SignedDelegation memory signedDelegation); |
| 1207 | |
| 1208 | /// Sign an EIP-7702 authorization for delegation for specific nonce |
| 1209 | function signDelegation(address implementation, uint256 privateKey, uint64 nonce) |
| 1210 | external |
| 1211 | returns (SignedDelegation memory signedDelegation); |
| 1212 | |
| 1213 | /// Sign an EIP-7702 authorization for delegation, with optional cross-chain validity. |
| 1214 | function signDelegation(address implementation, uint256 privateKey, bool crossChain) |
| 1215 | external |
| 1216 | returns (SignedDelegation memory signedDelegation); |
| 1217 | |
| 1218 | /// Has all subsequent calls (at this call depth only) create transactions that can later be signed and sent onchain. |
| 1219 | /// Broadcasting address is determined by checking the following in order: |
| 1220 | /// 1. If `--sender` argument was provided, that address is used. |
| 1221 | /// 2. If exactly one signer (e.g. private key, hw wallet, keystore) is set when `forge broadcast` is invoked, that signer is used. |
| 1222 | /// 3. Otherwise, default foundry sender (1804c8AB1F12E6bbf3894d4083f33e07309d1f38) is used. |
| 1223 | function startBroadcast() external; |
| 1224 | |
| 1225 | /// Has all subsequent calls (at this call depth only) create transactions with the address |
| 1226 | /// provided that can later be signed and sent onchain. |
| 1227 | function startBroadcast(address signer) external; |
| 1228 | |
| 1229 | /// Has all subsequent calls (at this call depth only) create transactions with the private key |
| 1230 | /// provided that can later be signed and sent onchain. |
| 1231 | function startBroadcast(uint256 privateKey) external; |
| 1232 | |
| 1233 | /// Stops collecting onchain transactions. |
| 1234 | function stopBroadcast() external; |
| 1235 | |
| 1236 | // ======== String ======== |
| 1237 | |
| 1238 | /// Returns true if `search` is found in `subject`, false otherwise. |
| 1239 | function contains(string calldata subject, string calldata search) external pure returns (bool result); |
| 1240 | |
| 1241 | /// Returns the index of the first occurrence of a `key` in an `input` string. |
| 1242 | /// Returns `NOT_FOUND` (i.e. `type(uint256).max`) if the `key` is not found. |
| 1243 | /// Returns 0 in case of an empty `key`. |
| 1244 | function indexOf(string calldata input, string calldata key) external pure returns (uint256); |
| 1245 | |
| 1246 | /// Parses the given `string` into an `address`. |
| 1247 | function parseAddress(string calldata stringifiedValue) external pure returns (address parsedValue); |
| 1248 | |
| 1249 | /// Parses the given `string` into a `bool`. |
| 1250 | function parseBool(string calldata stringifiedValue) external pure returns (bool parsedValue); |
| 1251 | |
| 1252 | /// Parses the given `string` into `bytes`. |
| 1253 | function parseBytes(string calldata stringifiedValue) external pure returns (bytes memory parsedValue); |
| 1254 | |
| 1255 | /// Parses the given `string` into a `bytes32`. |
| 1256 | function parseBytes32(string calldata stringifiedValue) external pure returns (bytes32 parsedValue); |
| 1257 | |
| 1258 | /// Parses the given `string` into a `int256`. |
| 1259 | function parseInt(string calldata stringifiedValue) external pure returns (int256 parsedValue); |
| 1260 | |
| 1261 | /// Parses the given `string` into a `uint256`. |
| 1262 | function parseUint(string calldata stringifiedValue) external pure returns (uint256 parsedValue); |
| 1263 | |
| 1264 | /// Replaces occurrences of `from` in the given `string` with `to`. |
| 1265 | function replace(string calldata input, string calldata from, string calldata to) |
| 1266 | external |
| 1267 | pure |
| 1268 | returns (string memory output); |
| 1269 | |
| 1270 | /// Splits the given `string` into an array of strings divided by the `delimiter`. |
| 1271 | function split(string calldata input, string calldata delimiter) external pure returns (string[] memory outputs); |
| 1272 | |
| 1273 | /// Converts the given `string` value to Lowercase. |
| 1274 | function toLowercase(string calldata input) external pure returns (string memory output); |
| 1275 | |
| 1276 | /// Converts the given value to a `string`. |
| 1277 | function toString(address value) external pure returns (string memory stringifiedValue); |
| 1278 | |
| 1279 | /// Converts the given value to a `string`. |
| 1280 | function toString(bytes calldata value) external pure returns (string memory stringifiedValue); |
| 1281 | |
| 1282 | /// Converts the given value to a `string`. |
| 1283 | function toString(bytes32 value) external pure returns (string memory stringifiedValue); |
| 1284 | |
| 1285 | /// Converts the given value to a `string`. |
| 1286 | function toString(bool value) external pure returns (string memory stringifiedValue); |
| 1287 | |
| 1288 | /// Converts the given value to a `string`. |
| 1289 | function toString(uint256 value) external pure returns (string memory stringifiedValue); |
| 1290 | |
| 1291 | /// Converts the given value to a `string`. |
| 1292 | function toString(int256 value) external pure returns (string memory stringifiedValue); |
| 1293 | |
| 1294 | /// Converts the given `string` value to Uppercase. |
| 1295 | function toUppercase(string calldata input) external pure returns (string memory output); |
| 1296 | |
| 1297 | /// Trims leading and trailing whitespace from the given `string` value. |
| 1298 | function trim(string calldata input) external pure returns (string memory output); |
| 1299 | |
| 1300 | // ======== Testing ======== |
| 1301 | |
| 1302 | /// Compares two `uint256` values. Expects difference to be less than or equal to `maxDelta`. |
| 1303 | /// Formats values with decimals in failure message. |
| 1304 | function assertApproxEqAbsDecimal(uint256 left, uint256 right, uint256 maxDelta, uint256 decimals) external pure; |
| 1305 | |
| 1306 | /// Compares two `uint256` values. Expects difference to be less than or equal to `maxDelta`. |
| 1307 | /// Formats values with decimals in failure message. Includes error message into revert string on failure. |
| 1308 | function assertApproxEqAbsDecimal( |
| 1309 | uint256 left, |
| 1310 | uint256 right, |
| 1311 | uint256 maxDelta, |
| 1312 | uint256 decimals, |
| 1313 | string calldata error |
| 1314 | ) external pure; |
| 1315 | |
| 1316 | /// Compares two `int256` values. Expects difference to be less than or equal to `maxDelta`. |
| 1317 | /// Formats values with decimals in failure message. |
| 1318 | function assertApproxEqAbsDecimal(int256 left, int256 right, uint256 maxDelta, uint256 decimals) external pure; |
| 1319 | |
| 1320 | /// Compares two `int256` values. Expects difference to be less than or equal to `maxDelta`. |
| 1321 | /// Formats values with decimals in failure message. Includes error message into revert string on failure. |
| 1322 | function assertApproxEqAbsDecimal( |
| 1323 | int256 left, |
| 1324 | int256 right, |
| 1325 | uint256 maxDelta, |
| 1326 | uint256 decimals, |
| 1327 | string calldata error |
| 1328 | ) external pure; |
| 1329 | |
| 1330 | /// Compares two `uint256` values. Expects difference to be less than or equal to `maxDelta`. |
| 1331 | function assertApproxEqAbs(uint256 left, uint256 right, uint256 maxDelta) external pure; |
| 1332 | |
| 1333 | /// Compares two `uint256` values. Expects difference to be less than or equal to `maxDelta`. |
| 1334 | /// Includes error message into revert string on failure. |
| 1335 | function assertApproxEqAbs(uint256 left, uint256 right, uint256 maxDelta, string calldata error) external pure; |
| 1336 | |
| 1337 | /// Compares two `int256` values. Expects difference to be less than or equal to `maxDelta`. |
| 1338 | function assertApproxEqAbs(int256 left, int256 right, uint256 maxDelta) external pure; |
| 1339 | |
| 1340 | /// Compares two `int256` values. Expects difference to be less than or equal to `maxDelta`. |
| 1341 | /// Includes error message into revert string on failure. |
| 1342 | function assertApproxEqAbs(int256 left, int256 right, uint256 maxDelta, string calldata error) external pure; |
| 1343 | |
| 1344 | /// Compares two `uint256` values. Expects relative difference in percents to be less than or equal to `maxPercentDelta`. |
| 1345 | /// `maxPercentDelta` is an 18 decimal fixed point number, where 1e18 == 100% |
| 1346 | /// Formats values with decimals in failure message. |
| 1347 | function assertApproxEqRelDecimal(uint256 left, uint256 right, uint256 maxPercentDelta, uint256 decimals) |
| 1348 | external |
| 1349 | pure; |
| 1350 | |
| 1351 | /// Compares two `uint256` values. Expects relative difference in percents to be less than or equal to `maxPercentDelta`. |
| 1352 | /// `maxPercentDelta` is an 18 decimal fixed point number, where 1e18 == 100% |
| 1353 | /// Formats values with decimals in failure message. Includes error message into revert string on failure. |
| 1354 | function assertApproxEqRelDecimal( |
| 1355 | uint256 left, |
| 1356 | uint256 right, |
| 1357 | uint256 maxPercentDelta, |
| 1358 | uint256 decimals, |
| 1359 | string calldata error |
| 1360 | ) external pure; |
| 1361 | |
| 1362 | /// Compares two `int256` values. Expects relative difference in percents to be less than or equal to `maxPercentDelta`. |
| 1363 | /// `maxPercentDelta` is an 18 decimal fixed point number, where 1e18 == 100% |
| 1364 | /// Formats values with decimals in failure message. |
| 1365 | function assertApproxEqRelDecimal(int256 left, int256 right, uint256 maxPercentDelta, uint256 decimals) |
| 1366 | external |
| 1367 | pure; |
| 1368 | |
| 1369 | /// Compares two `int256` values. Expects relative difference in percents to be less than or equal to `maxPercentDelta`. |
| 1370 | /// `maxPercentDelta` is an 18 decimal fixed point number, where 1e18 == 100% |
| 1371 | /// Formats values with decimals in failure message. Includes error message into revert string on failure. |
| 1372 | function assertApproxEqRelDecimal( |
| 1373 | int256 left, |
| 1374 | int256 right, |
| 1375 | uint256 maxPercentDelta, |
| 1376 | uint256 decimals, |
| 1377 | string calldata error |
| 1378 | ) external pure; |
| 1379 | |
| 1380 | /// Compares two `uint256` values. Expects relative difference in percents to be less than or equal to `maxPercentDelta`. |
| 1381 | /// `maxPercentDelta` is an 18 decimal fixed point number, where 1e18 == 100% |
| 1382 | function assertApproxEqRel(uint256 left, uint256 right, uint256 maxPercentDelta) external pure; |
| 1383 | |
| 1384 | /// Compares two `uint256` values. Expects relative difference in percents to be less than or equal to `maxPercentDelta`. |
| 1385 | /// `maxPercentDelta` is an 18 decimal fixed point number, where 1e18 == 100% |
| 1386 | /// Includes error message into revert string on failure. |
| 1387 | function assertApproxEqRel(uint256 left, uint256 right, uint256 maxPercentDelta, string calldata error) |
| 1388 | external |
| 1389 | pure; |
| 1390 | |
| 1391 | /// Compares two `int256` values. Expects relative difference in percents to be less than or equal to `maxPercentDelta`. |
| 1392 | /// `maxPercentDelta` is an 18 decimal fixed point number, where 1e18 == 100% |
| 1393 | function assertApproxEqRel(int256 left, int256 right, uint256 maxPercentDelta) external pure; |
| 1394 | |
| 1395 | /// Compares two `int256` values. Expects relative difference in percents to be less than or equal to `maxPercentDelta`. |
| 1396 | /// `maxPercentDelta` is an 18 decimal fixed point number, where 1e18 == 100% |
| 1397 | /// Includes error message into revert string on failure. |
| 1398 | function assertApproxEqRel(int256 left, int256 right, uint256 maxPercentDelta, string calldata error) external pure; |
| 1399 | |
| 1400 | /// Asserts that two `uint256` values are equal, formatting them with decimals in failure message. |
| 1401 | function assertEqDecimal(uint256 left, uint256 right, uint256 decimals) external pure; |
| 1402 | |
| 1403 | /// Asserts that two `uint256` values are equal, formatting them with decimals in failure message. |
| 1404 | /// Includes error message into revert string on failure. |
| 1405 | function assertEqDecimal(uint256 left, uint256 right, uint256 decimals, string calldata error) external pure; |
| 1406 | |
| 1407 | /// Asserts that two `int256` values are equal, formatting them with decimals in failure message. |
| 1408 | function assertEqDecimal(int256 left, int256 right, uint256 decimals) external pure; |
| 1409 | |
| 1410 | /// Asserts that two `int256` values are equal, formatting them with decimals in failure message. |
| 1411 | /// Includes error message into revert string on failure. |
| 1412 | function assertEqDecimal(int256 left, int256 right, uint256 decimals, string calldata error) external pure; |
| 1413 | |
| 1414 | /// Asserts that two `bool` values are equal. |
| 1415 | function assertEq(bool left, bool right) external pure; |
| 1416 | |
| 1417 | /// Asserts that two `bool` values are equal and includes error message into revert string on failure. |
| 1418 | function assertEq(bool left, bool right, string calldata error) external pure; |
| 1419 | |
| 1420 | /// Asserts that two `string` values are equal. |
| 1421 | function assertEq(string calldata left, string calldata right) external pure; |
| 1422 | |
| 1423 | /// Asserts that two `string` values are equal and includes error message into revert string on failure. |
| 1424 | function assertEq(string calldata left, string calldata right, string calldata error) external pure; |
| 1425 | |
| 1426 | /// Asserts that two `bytes` values are equal. |
| 1427 | function assertEq(bytes calldata left, bytes calldata right) external pure; |
| 1428 | |
| 1429 | /// Asserts that two `bytes` values are equal and includes error message into revert string on failure. |
| 1430 | function assertEq(bytes calldata left, bytes calldata right, string calldata error) external pure; |
| 1431 | |
| 1432 | /// Asserts that two arrays of `bool` values are equal. |
| 1433 | function assertEq(bool[] calldata left, bool[] calldata right) external pure; |
| 1434 | |
| 1435 | /// Asserts that two arrays of `bool` values are equal and includes error message into revert string on failure. |
| 1436 | function assertEq(bool[] calldata left, bool[] calldata right, string calldata error) external pure; |
| 1437 | |
| 1438 | /// Asserts that two arrays of `uint256 values are equal. |
| 1439 | function assertEq(uint256[] calldata left, uint256[] calldata right) external pure; |
| 1440 | |
| 1441 | /// Asserts that two arrays of `uint256` values are equal and includes error message into revert string on failure. |
| 1442 | function assertEq(uint256[] calldata left, uint256[] calldata right, string calldata error) external pure; |
| 1443 | |
| 1444 | /// Asserts that two arrays of `int256` values are equal. |
| 1445 | function assertEq(int256[] calldata left, int256[] calldata right) external pure; |
| 1446 | |
| 1447 | /// Asserts that two arrays of `int256` values are equal and includes error message into revert string on failure. |
| 1448 | function assertEq(int256[] calldata left, int256[] calldata right, string calldata error) external pure; |
| 1449 | |
| 1450 | /// Asserts that two `uint256` values are equal. |
| 1451 | function assertEq(uint256 left, uint256 right) external pure; |
| 1452 | |
| 1453 | /// Asserts that two arrays of `address` values are equal. |
| 1454 | function assertEq(address[] calldata left, address[] calldata right) external pure; |
| 1455 | |
| 1456 | /// Asserts that two arrays of `address` values are equal and includes error message into revert string on failure. |
| 1457 | function assertEq(address[] calldata left, address[] calldata right, string calldata error) external pure; |
| 1458 | |
| 1459 | /// Asserts that two arrays of `bytes32` values are equal. |
| 1460 | function assertEq(bytes32[] calldata left, bytes32[] calldata right) external pure; |
| 1461 | |
| 1462 | /// Asserts that two arrays of `bytes32` values are equal and includes error message into revert string on failure. |
| 1463 | function assertEq(bytes32[] calldata left, bytes32[] calldata right, string calldata error) external pure; |
| 1464 | |
| 1465 | /// Asserts that two arrays of `string` values are equal. |
| 1466 | function assertEq(string[] calldata left, string[] calldata right) external pure; |
| 1467 | |
| 1468 | /// Asserts that two arrays of `string` values are equal and includes error message into revert string on failure. |
| 1469 | function assertEq(string[] calldata left, string[] calldata right, string calldata error) external pure; |
| 1470 | |
| 1471 | /// Asserts that two arrays of `bytes` values are equal. |
| 1472 | function assertEq(bytes[] calldata left, bytes[] calldata right) external pure; |
| 1473 | |
| 1474 | /// Asserts that two arrays of `bytes` values are equal and includes error message into revert string on failure. |
| 1475 | function assertEq(bytes[] calldata left, bytes[] calldata right, string calldata error) external pure; |
| 1476 | |
| 1477 | /// Asserts that two `uint256` values are equal and includes error message into revert string on failure. |
| 1478 | function assertEq(uint256 left, uint256 right, string calldata error) external pure; |
| 1479 | |
| 1480 | /// Asserts that two `int256` values are equal. |
| 1481 | function assertEq(int256 left, int256 right) external pure; |
| 1482 | |
| 1483 | /// Asserts that two `int256` values are equal and includes error message into revert string on failure. |
| 1484 | function assertEq(int256 left, int256 right, string calldata error) external pure; |
| 1485 | |
| 1486 | /// Asserts that two `address` values are equal. |
| 1487 | function assertEq(address left, address right) external pure; |
| 1488 | |
| 1489 | /// Asserts that two `address` values are equal and includes error message into revert string on failure. |
| 1490 | function assertEq(address left, address right, string calldata error) external pure; |
| 1491 | |
| 1492 | /// Asserts that two `bytes32` values are equal. |
| 1493 | function assertEq(bytes32 left, bytes32 right) external pure; |
| 1494 | |
| 1495 | /// Asserts that two `bytes32` values are equal and includes error message into revert string on failure. |
| 1496 | function assertEq(bytes32 left, bytes32 right, string calldata error) external pure; |
| 1497 | |
| 1498 | /// Asserts that the given condition is false. |
| 1499 | function assertFalse(bool condition) external pure; |
| 1500 | |
| 1501 | /// Asserts that the given condition is false and includes error message into revert string on failure. |
| 1502 | function assertFalse(bool condition, string calldata error) external pure; |
| 1503 | |
| 1504 | /// Compares two `uint256` values. Expects first value to be greater than or equal to second. |
| 1505 | /// Formats values with decimals in failure message. |
| 1506 | function assertGeDecimal(uint256 left, uint256 right, uint256 decimals) external pure; |
| 1507 | |
| 1508 | /// Compares two `uint256` values. Expects first value to be greater than or equal to second. |
| 1509 | /// Formats values with decimals in failure message. Includes error message into revert string on failure. |
| 1510 | function assertGeDecimal(uint256 left, uint256 right, uint256 decimals, string calldata error) external pure; |
| 1511 | |
| 1512 | /// Compares two `int256` values. Expects first value to be greater than or equal to second. |
| 1513 | /// Formats values with decimals in failure message. |
| 1514 | function assertGeDecimal(int256 left, int256 right, uint256 decimals) external pure; |
| 1515 | |
| 1516 | /// Compares two `int256` values. Expects first value to be greater than or equal to second. |
| 1517 | /// Formats values with decimals in failure message. Includes error message into revert string on failure. |
| 1518 | function assertGeDecimal(int256 left, int256 right, uint256 decimals, string calldata error) external pure; |
| 1519 | |
| 1520 | /// Compares two `uint256` values. Expects first value to be greater than or equal to second. |
| 1521 | function assertGe(uint256 left, uint256 right) external pure; |
| 1522 | |
| 1523 | /// Compares two `uint256` values. Expects first value to be greater than or equal to second. |
| 1524 | /// Includes error message into revert string on failure. |
| 1525 | function assertGe(uint256 left, uint256 right, string calldata error) external pure; |
| 1526 | |
| 1527 | /// Compares two `int256` values. Expects first value to be greater than or equal to second. |
| 1528 | function assertGe(int256 left, int256 right) external pure; |
| 1529 | |
| 1530 | /// Compares two `int256` values. Expects first value to be greater than or equal to second. |
| 1531 | /// Includes error message into revert string on failure. |
| 1532 | function assertGe(int256 left, int256 right, string calldata error) external pure; |
| 1533 | |
| 1534 | /// Compares two `uint256` values. Expects first value to be greater than second. |
| 1535 | /// Formats values with decimals in failure message. |
| 1536 | function assertGtDecimal(uint256 left, uint256 right, uint256 decimals) external pure; |
| 1537 | |
| 1538 | /// Compares two `uint256` values. Expects first value to be greater than second. |
| 1539 | /// Formats values with decimals in failure message. Includes error message into revert string on failure. |
| 1540 | function assertGtDecimal(uint256 left, uint256 right, uint256 decimals, string calldata error) external pure; |
| 1541 | |
| 1542 | /// Compares two `int256` values. Expects first value to be greater than second. |
| 1543 | /// Formats values with decimals in failure message. |
| 1544 | function assertGtDecimal(int256 left, int256 right, uint256 decimals) external pure; |
| 1545 | |
| 1546 | /// Compares two `int256` values. Expects first value to be greater than second. |
| 1547 | /// Formats values with decimals in failure message. Includes error message into revert string on failure. |
| 1548 | function assertGtDecimal(int256 left, int256 right, uint256 decimals, string calldata error) external pure; |
| 1549 | |
| 1550 | /// Compares two `uint256` values. Expects first value to be greater than second. |
| 1551 | function assertGt(uint256 left, uint256 right) external pure; |
| 1552 | |
| 1553 | /// Compares two `uint256` values. Expects first value to be greater than second. |
| 1554 | /// Includes error message into revert string on failure. |
| 1555 | function assertGt(uint256 left, uint256 right, string calldata error) external pure; |
| 1556 | |
| 1557 | /// Compares two `int256` values. Expects first value to be greater than second. |
| 1558 | function assertGt(int256 left, int256 right) external pure; |
| 1559 | |
| 1560 | /// Compares two `int256` values. Expects first value to be greater than second. |
| 1561 | /// Includes error message into revert string on failure. |
| 1562 | function assertGt(int256 left, int256 right, string calldata error) external pure; |
| 1563 | |
| 1564 | /// Compares two `uint256` values. Expects first value to be less than or equal to second. |
| 1565 | /// Formats values with decimals in failure message. |
| 1566 | function assertLeDecimal(uint256 left, uint256 right, uint256 decimals) external pure; |
| 1567 | |
| 1568 | /// Compares two `uint256` values. Expects first value to be less than or equal to second. |
| 1569 | /// Formats values with decimals in failure message. Includes error message into revert string on failure. |
| 1570 | function assertLeDecimal(uint256 left, uint256 right, uint256 decimals, string calldata error) external pure; |
| 1571 | |
| 1572 | /// Compares two `int256` values. Expects first value to be less than or equal to second. |
| 1573 | /// Formats values with decimals in failure message. |
| 1574 | function assertLeDecimal(int256 left, int256 right, uint256 decimals) external pure; |
| 1575 | |
| 1576 | /// Compares two `int256` values. Expects first value to be less than or equal to second. |
| 1577 | /// Formats values with decimals in failure message. Includes error message into revert string on failure. |
| 1578 | function assertLeDecimal(int256 left, int256 right, uint256 decimals, string calldata error) external pure; |
| 1579 | |
| 1580 | /// Compares two `uint256` values. Expects first value to be less than or equal to second. |
| 1581 | function assertLe(uint256 left, uint256 right) external pure; |
| 1582 | |
| 1583 | /// Compares two `uint256` values. Expects first value to be less than or equal to second. |
| 1584 | /// Includes error message into revert string on failure. |
| 1585 | function assertLe(uint256 left, uint256 right, string calldata error) external pure; |
| 1586 | |
| 1587 | /// Compares two `int256` values. Expects first value to be less than or equal to second. |
| 1588 | function assertLe(int256 left, int256 right) external pure; |
| 1589 | |
| 1590 | /// Compares two `int256` values. Expects first value to be less than or equal to second. |
| 1591 | /// Includes error message into revert string on failure. |
| 1592 | function assertLe(int256 left, int256 right, string calldata error) external pure; |
| 1593 | |
| 1594 | /// Compares two `uint256` values. Expects first value to be less than second. |
| 1595 | /// Formats values with decimals in failure message. |
| 1596 | function assertLtDecimal(uint256 left, uint256 right, uint256 decimals) external pure; |
| 1597 | |
| 1598 | /// Compares two `uint256` values. Expects first value to be less than second. |
| 1599 | /// Formats values with decimals in failure message. Includes error message into revert string on failure. |
| 1600 | function assertLtDecimal(uint256 left, uint256 right, uint256 decimals, string calldata error) external pure; |
| 1601 | |
| 1602 | /// Compares two `int256` values. Expects first value to be less than second. |
| 1603 | /// Formats values with decimals in failure message. |
| 1604 | function assertLtDecimal(int256 left, int256 right, uint256 decimals) external pure; |
| 1605 | |
| 1606 | /// Compares two `int256` values. Expects first value to be less than second. |
| 1607 | /// Formats values with decimals in failure message. Includes error message into revert string on failure. |
| 1608 | function assertLtDecimal(int256 left, int256 right, uint256 decimals, string calldata error) external pure; |
| 1609 | |
| 1610 | /// Compares two `uint256` values. Expects first value to be less than second. |
| 1611 | function assertLt(uint256 left, uint256 right) external pure; |
| 1612 | |
| 1613 | /// Compares two `uint256` values. Expects first value to be less than second. |
| 1614 | /// Includes error message into revert string on failure. |
| 1615 | function assertLt(uint256 left, uint256 right, string calldata error) external pure; |
| 1616 | |
| 1617 | /// Compares two `int256` values. Expects first value to be less than second. |
| 1618 | function assertLt(int256 left, int256 right) external pure; |
| 1619 | |
| 1620 | /// Compares two `int256` values. Expects first value to be less than second. |
| 1621 | /// Includes error message into revert string on failure. |
| 1622 | function assertLt(int256 left, int256 right, string calldata error) external pure; |
| 1623 | |
| 1624 | /// Asserts that two `uint256` values are not equal, formatting them with decimals in failure message. |
| 1625 | function assertNotEqDecimal(uint256 left, uint256 right, uint256 decimals) external pure; |
| 1626 | |
| 1627 | /// Asserts that two `uint256` values are not equal, formatting them with decimals in failure message. |
| 1628 | /// Includes error message into revert string on failure. |
| 1629 | function assertNotEqDecimal(uint256 left, uint256 right, uint256 decimals, string calldata error) external pure; |
| 1630 | |
| 1631 | /// Asserts that two `int256` values are not equal, formatting them with decimals in failure message. |
| 1632 | function assertNotEqDecimal(int256 left, int256 right, uint256 decimals) external pure; |
| 1633 | |
| 1634 | /// Asserts that two `int256` values are not equal, formatting them with decimals in failure message. |
| 1635 | /// Includes error message into revert string on failure. |
| 1636 | function assertNotEqDecimal(int256 left, int256 right, uint256 decimals, string calldata error) external pure; |
| 1637 | |
| 1638 | /// Asserts that two `bool` values are not equal. |
| 1639 | function assertNotEq(bool left, bool right) external pure; |
| 1640 | |
| 1641 | /// Asserts that two `bool` values are not equal and includes error message into revert string on failure. |
| 1642 | function assertNotEq(bool left, bool right, string calldata error) external pure; |
| 1643 | |
| 1644 | /// Asserts that two `string` values are not equal. |
| 1645 | function assertNotEq(string calldata left, string calldata right) external pure; |
| 1646 | |
| 1647 | /// Asserts that two `string` values are not equal and includes error message into revert string on failure. |
| 1648 | function assertNotEq(string calldata left, string calldata right, string calldata error) external pure; |
| 1649 | |
| 1650 | /// Asserts that two `bytes` values are not equal. |
| 1651 | function assertNotEq(bytes calldata left, bytes calldata right) external pure; |
| 1652 | |
| 1653 | /// Asserts that two `bytes` values are not equal and includes error message into revert string on failure. |
| 1654 | function assertNotEq(bytes calldata left, bytes calldata right, string calldata error) external pure; |
| 1655 | |
| 1656 | /// Asserts that two arrays of `bool` values are not equal. |
| 1657 | function assertNotEq(bool[] calldata left, bool[] calldata right) external pure; |
| 1658 | |
| 1659 | /// Asserts that two arrays of `bool` values are not equal and includes error message into revert string on failure. |
| 1660 | function assertNotEq(bool[] calldata left, bool[] calldata right, string calldata error) external pure; |
| 1661 | |
| 1662 | /// Asserts that two arrays of `uint256` values are not equal. |
| 1663 | function assertNotEq(uint256[] calldata left, uint256[] calldata right) external pure; |
| 1664 | |
| 1665 | /// Asserts that two arrays of `uint256` values are not equal and includes error message into revert string on failure. |
| 1666 | function assertNotEq(uint256[] calldata left, uint256[] calldata right, string calldata error) external pure; |
| 1667 | |
| 1668 | /// Asserts that two arrays of `int256` values are not equal. |
| 1669 | function assertNotEq(int256[] calldata left, int256[] calldata right) external pure; |
| 1670 | |
| 1671 | /// Asserts that two arrays of `int256` values are not equal and includes error message into revert string on failure. |
| 1672 | function assertNotEq(int256[] calldata left, int256[] calldata right, string calldata error) external pure; |
| 1673 | |
| 1674 | /// Asserts that two `uint256` values are not equal. |
| 1675 | function assertNotEq(uint256 left, uint256 right) external pure; |
| 1676 | |
| 1677 | /// Asserts that two arrays of `address` values are not equal. |
| 1678 | function assertNotEq(address[] calldata left, address[] calldata right) external pure; |
| 1679 | |
| 1680 | /// Asserts that two arrays of `address` values are not equal and includes error message into revert string on failure. |
| 1681 | function assertNotEq(address[] calldata left, address[] calldata right, string calldata error) external pure; |
| 1682 | |
| 1683 | /// Asserts that two arrays of `bytes32` values are not equal. |
| 1684 | function assertNotEq(bytes32[] calldata left, bytes32[] calldata right) external pure; |
| 1685 | |
| 1686 | /// Asserts that two arrays of `bytes32` values are not equal and includes error message into revert string on failure. |
| 1687 | function assertNotEq(bytes32[] calldata left, bytes32[] calldata right, string calldata error) external pure; |
| 1688 | |
| 1689 | /// Asserts that two arrays of `string` values are not equal. |
| 1690 | function assertNotEq(string[] calldata left, string[] calldata right) external pure; |
| 1691 | |
| 1692 | /// Asserts that two arrays of `string` values are not equal and includes error message into revert string on failure. |
| 1693 | function assertNotEq(string[] calldata left, string[] calldata right, string calldata error) external pure; |
| 1694 | |
| 1695 | /// Asserts that two arrays of `bytes` values are not equal. |
| 1696 | function assertNotEq(bytes[] calldata left, bytes[] calldata right) external pure; |
| 1697 | |
| 1698 | /// Asserts that two arrays of `bytes` values are not equal and includes error message into revert string on failure. |
| 1699 | function assertNotEq(bytes[] calldata left, bytes[] calldata right, string calldata error) external pure; |
| 1700 | |
| 1701 | /// Asserts that two `uint256` values are not equal and includes error message into revert string on failure. |
| 1702 | function assertNotEq(uint256 left, uint256 right, string calldata error) external pure; |
| 1703 | |
| 1704 | /// Asserts that two `int256` values are not equal. |
| 1705 | function assertNotEq(int256 left, int256 right) external pure; |
| 1706 | |
| 1707 | /// Asserts that two `int256` values are not equal and includes error message into revert string on failure. |
| 1708 | function assertNotEq(int256 left, int256 right, string calldata error) external pure; |
| 1709 | |
| 1710 | /// Asserts that two `address` values are not equal. |
| 1711 | function assertNotEq(address left, address right) external pure; |
| 1712 | |
| 1713 | /// Asserts that two `address` values are not equal and includes error message into revert string on failure. |
| 1714 | function assertNotEq(address left, address right, string calldata error) external pure; |
| 1715 | |
| 1716 | /// Asserts that two `bytes32` values are not equal. |
| 1717 | function assertNotEq(bytes32 left, bytes32 right) external pure; |
| 1718 | |
| 1719 | /// Asserts that two `bytes32` values are not equal and includes error message into revert string on failure. |
| 1720 | function assertNotEq(bytes32 left, bytes32 right, string calldata error) external pure; |
| 1721 | |
| 1722 | /// Asserts that the given condition is true. |
| 1723 | function assertTrue(bool condition) external pure; |
| 1724 | |
| 1725 | /// Asserts that the given condition is true and includes error message into revert string on failure. |
| 1726 | function assertTrue(bool condition, string calldata error) external pure; |
| 1727 | |
| 1728 | /// If the condition is false, discard this run's fuzz inputs and generate new ones. |
| 1729 | function assume(bool condition) external pure; |
| 1730 | |
| 1731 | /// Discard this run's fuzz inputs and generate new ones if next call reverted. |
| 1732 | function assumeNoRevert() external pure; |
| 1733 | |
| 1734 | /// Discard this run's fuzz inputs and generate new ones if next call reverts with the potential revert parameters. |
| 1735 | function assumeNoRevert(PotentialRevert calldata potentialRevert) external pure; |
| 1736 | |
| 1737 | /// Discard this run's fuzz inputs and generate new ones if next call reverts with the any of the potential revert parameters. |
| 1738 | function assumeNoRevert(PotentialRevert[] calldata potentialReverts) external pure; |
| 1739 | |
| 1740 | /// Writes a breakpoint to jump to in the debugger. |
| 1741 | function breakpoint(string calldata char) external pure; |
| 1742 | |
| 1743 | /// Writes a conditional breakpoint to jump to in the debugger. |
| 1744 | function breakpoint(string calldata char, bool value) external pure; |
| 1745 | |
| 1746 | /// Returns true if the current Foundry version is greater than or equal to the given version. |
| 1747 | /// The given version string must be in the format `major.minor.patch`. |
| 1748 | /// This is equivalent to `foundryVersionCmp(version) >= 0`. |
| 1749 | function foundryVersionAtLeast(string calldata version) external view returns (bool); |
| 1750 | |
| 1751 | /// Compares the current Foundry version with the given version string. |
| 1752 | /// The given version string must be in the format `major.minor.patch`. |
| 1753 | /// Returns: |
| 1754 | /// -1 if current Foundry version is less than the given version |
| 1755 | /// 0 if current Foundry version equals the given version |
| 1756 | /// 1 if current Foundry version is greater than the given version |
| 1757 | /// This result can then be used with a comparison operator against `0`. |
| 1758 | /// For example, to check if the current Foundry version is greater than or equal to `1.0.0`: |
| 1759 | /// `if (foundryVersionCmp("1.0.0") >= 0) { ... }` |
| 1760 | function foundryVersionCmp(string calldata version) external view returns (int256); |
| 1761 | |
| 1762 | /// Returns a Chain struct for specific alias |
| 1763 | function getChain(string calldata chainAlias) external view returns (Chain memory chain); |
| 1764 | |
| 1765 | /// Returns a Chain struct for specific chainId |
| 1766 | function getChain(uint256 chainId) external view returns (Chain memory chain); |
| 1767 | |
| 1768 | /// Returns the Foundry version. |
| 1769 | /// Format: <cargo_version>-<tag>+<git_sha_short>.<unix_build_timestamp>.<profile> |
| 1770 | /// Sample output: 0.3.0-nightly+3cb96bde9b.1737036656.debug |
| 1771 | /// Note: Build timestamps may vary slightly across platforms due to separate CI jobs. |
| 1772 | /// For reliable version comparisons, use UNIX format (e.g., >= 1700000000) |
| 1773 | /// to compare timestamps while ignoring minor time differences. |
| 1774 | function getFoundryVersion() external view returns (string memory version); |
| 1775 | |
| 1776 | /// Returns the RPC url for the given alias. |
| 1777 | function rpcUrl(string calldata rpcAlias) external view returns (string memory json); |
| 1778 | |
| 1779 | /// Returns all rpc urls and their aliases as structs. |
| 1780 | function rpcUrlStructs() external view returns (Rpc[] memory urls); |
| 1781 | |
| 1782 | /// Returns all rpc urls and their aliases `[alias, url][]`. |
| 1783 | function rpcUrls() external view returns (string[2][] memory urls); |
| 1784 | |
| 1785 | /// Suspends execution of the main thread for `duration` milliseconds. |
| 1786 | function sleep(uint256 duration) external; |
| 1787 | |
| 1788 | // ======== Toml ======== |
| 1789 | |
| 1790 | /// Checks if `key` exists in a TOML table. |
| 1791 | function keyExistsToml(string calldata toml, string calldata key) external view returns (bool); |
| 1792 | |
| 1793 | /// Parses a string of TOML data at `key` and coerces it to `address`. |
| 1794 | function parseTomlAddress(string calldata toml, string calldata key) external pure returns (address); |
| 1795 | |
| 1796 | /// Parses a string of TOML data at `key` and coerces it to `address[]`. |
| 1797 | function parseTomlAddressArray(string calldata toml, string calldata key) external pure returns (address[] memory); |
| 1798 | |
| 1799 | /// Parses a string of TOML data at `key` and coerces it to `bool`. |
| 1800 | function parseTomlBool(string calldata toml, string calldata key) external pure returns (bool); |
| 1801 | |
| 1802 | /// Parses a string of TOML data at `key` and coerces it to `bool[]`. |
| 1803 | function parseTomlBoolArray(string calldata toml, string calldata key) external pure returns (bool[] memory); |
| 1804 | |
| 1805 | /// Parses a string of TOML data at `key` and coerces it to `bytes`. |
| 1806 | function parseTomlBytes(string calldata toml, string calldata key) external pure returns (bytes memory); |
| 1807 | |
| 1808 | /// Parses a string of TOML data at `key` and coerces it to `bytes32`. |
| 1809 | function parseTomlBytes32(string calldata toml, string calldata key) external pure returns (bytes32); |
| 1810 | |
| 1811 | /// Parses a string of TOML data at `key` and coerces it to `bytes32[]`. |
| 1812 | function parseTomlBytes32Array(string calldata toml, string calldata key) external pure returns (bytes32[] memory); |
| 1813 | |
| 1814 | /// Parses a string of TOML data at `key` and coerces it to `bytes[]`. |
| 1815 | function parseTomlBytesArray(string calldata toml, string calldata key) external pure returns (bytes[] memory); |
| 1816 | |
| 1817 | /// Parses a string of TOML data at `key` and coerces it to `int256`. |
| 1818 | function parseTomlInt(string calldata toml, string calldata key) external pure returns (int256); |
| 1819 | |
| 1820 | /// Parses a string of TOML data at `key` and coerces it to `int256[]`. |
| 1821 | function parseTomlIntArray(string calldata toml, string calldata key) external pure returns (int256[] memory); |
| 1822 | |
| 1823 | /// Returns an array of all the keys in a TOML table. |
| 1824 | function parseTomlKeys(string calldata toml, string calldata key) external pure returns (string[] memory keys); |
| 1825 | |
| 1826 | /// Parses a string of TOML data at `key` and coerces it to `string`. |
| 1827 | function parseTomlString(string calldata toml, string calldata key) external pure returns (string memory); |
| 1828 | |
| 1829 | /// Parses a string of TOML data at `key` and coerces it to `string[]`. |
| 1830 | function parseTomlStringArray(string calldata toml, string calldata key) external pure returns (string[] memory); |
| 1831 | |
| 1832 | /// Parses a string of TOML data at `key` and coerces it to type array corresponding to `typeDescription`. |
| 1833 | function parseTomlTypeArray(string calldata toml, string calldata key, string calldata typeDescription) |
| 1834 | external |
| 1835 | pure |
| 1836 | returns (bytes memory); |
| 1837 | |
| 1838 | /// Parses a string of TOML data and coerces it to type corresponding to `typeDescription`. |
| 1839 | function parseTomlType(string calldata toml, string calldata typeDescription) external pure returns (bytes memory); |
| 1840 | |
| 1841 | /// Parses a string of TOML data at `key` and coerces it to type corresponding to `typeDescription`. |
| 1842 | function parseTomlType(string calldata toml, string calldata key, string calldata typeDescription) |
| 1843 | external |
| 1844 | pure |
| 1845 | returns (bytes memory); |
| 1846 | |
| 1847 | /// Parses a string of TOML data at `key` and coerces it to `uint256`. |
| 1848 | function parseTomlUint(string calldata toml, string calldata key) external pure returns (uint256); |
| 1849 | |
| 1850 | /// Parses a string of TOML data at `key` and coerces it to `uint256[]`. |
| 1851 | function parseTomlUintArray(string calldata toml, string calldata key) external pure returns (uint256[] memory); |
| 1852 | |
| 1853 | /// ABI-encodes a TOML table. |
| 1854 | function parseToml(string calldata toml) external pure returns (bytes memory abiEncodedData); |
| 1855 | |
| 1856 | /// ABI-encodes a TOML table at `key`. |
| 1857 | function parseToml(string calldata toml, string calldata key) external pure returns (bytes memory abiEncodedData); |
| 1858 | |
| 1859 | /// Takes serialized JSON, converts to TOML and write a serialized TOML to a file. |
| 1860 | function writeToml(string calldata json, string calldata path) external; |
| 1861 | |
| 1862 | /// Takes serialized JSON, converts to TOML and write a serialized TOML table to an **existing** TOML file, replacing a value with key = <value_key.> |
| 1863 | /// This is useful to replace a specific value of a TOML file, without having to parse the entire thing. |
| 1864 | /// This cheatcode will create new keys if they didn't previously exist. |
| 1865 | function writeToml(string calldata json, string calldata path, string calldata valueKey) external; |
| 1866 | |
| 1867 | // ======== Utilities ======== |
| 1868 | |
| 1869 | /// Returns an uint256 value bounded in given range and different from the current one. |
| 1870 | function bound(uint256 current, uint256 min, uint256 max) external view returns (uint256); |
| 1871 | |
| 1872 | /// Returns an int256 value bounded in given range and different from the current one. |
| 1873 | function bound(int256 current, int256 min, int256 max) external view returns (int256); |
| 1874 | |
| 1875 | /// Compute the address of a contract created with CREATE2 using the given CREATE2 deployer. |
| 1876 | function computeCreate2Address(bytes32 salt, bytes32 initCodeHash, address deployer) external pure returns (address); |
| 1877 | |
| 1878 | /// Compute the address of a contract created with CREATE2 using the default CREATE2 deployer. |
| 1879 | function computeCreate2Address(bytes32 salt, bytes32 initCodeHash) external pure returns (address); |
| 1880 | |
| 1881 | /// Compute the address a contract will be deployed at for a given deployer address and nonce. |
| 1882 | function computeCreateAddress(address deployer, uint256 nonce) external pure returns (address); |
| 1883 | |
| 1884 | /// Utility cheatcode to copy storage of `from` contract to another `to` contract. |
| 1885 | function copyStorage(address from, address to) external; |
| 1886 | |
| 1887 | /// Generates the struct hash of the canonical EIP-712 type representation and its abi-encoded data. |
| 1888 | /// Supports 2 different inputs: |
| 1889 | /// 1. Name of the type (i.e. "PermitSingle"): |
| 1890 | /// * requires previous binding generation with `forge bind-json`. |
| 1891 | /// * bindings will be retrieved from the path configured in `foundry.toml`. |
| 1892 | /// 2. String representation of the type (i.e. "Foo(Bar bar) Bar(uint256 baz)"). |
| 1893 | /// * Note: the cheatcode will use the canonical type even if the input is malformated |
| 1894 | /// with the wrong order of elements or with extra whitespaces. |
| 1895 | function eip712HashStruct(string calldata typeNameOrDefinition, bytes calldata abiEncodedData) |
| 1896 | external |
| 1897 | pure |
| 1898 | returns (bytes32 typeHash); |
| 1899 | |
| 1900 | /// Generates the struct hash of the canonical EIP-712 type representation and its abi-encoded data. |
| 1901 | /// Requires previous binding generation with `forge bind-json`. |
| 1902 | /// Params: |
| 1903 | /// * `bindingsPath`: path where the output of `forge bind-json` is stored. |
| 1904 | /// * `typeName`: Name of the type (i.e. "PermitSingle"). |
| 1905 | /// * `abiEncodedData`: ABI-encoded data for the struct that is being hashed. |
| 1906 | function eip712HashStruct(string calldata bindingsPath, string calldata typeName, bytes calldata abiEncodedData) |
| 1907 | external |
| 1908 | pure |
| 1909 | returns (bytes32 typeHash); |
| 1910 | |
| 1911 | /// Generates the hash of the canonical EIP-712 type representation. |
| 1912 | /// Supports 2 different inputs: |
| 1913 | /// 1. Name of the type (i.e. "Transaction"): |
| 1914 | /// * requires previous binding generation with `forge bind-json`. |
| 1915 | /// * bindings will be retrieved from the path configured in `foundry.toml`. |
| 1916 | /// 2. String representation of the type (i.e. "Foo(Bar bar) Bar(uint256 baz)"). |
| 1917 | /// * Note: the cheatcode will output the canonical type even if the input is malformated |
| 1918 | /// with the wrong order of elements or with extra whitespaces. |
| 1919 | function eip712HashType(string calldata typeNameOrDefinition) external pure returns (bytes32 typeHash); |
| 1920 | |
| 1921 | /// Generates the hash of the canonical EIP-712 type representation. |
| 1922 | /// Requires previous binding generation with `forge bind-json`. |
| 1923 | /// Params: |
| 1924 | /// * `bindingsPath`: path where the output of `forge bind-json` is stored. |
| 1925 | /// * `typeName`: Name of the type (i.e. "Transaction"). |
| 1926 | function eip712HashType(string calldata bindingsPath, string calldata typeName) |
| 1927 | external |
| 1928 | pure |
| 1929 | returns (bytes32 typeHash); |
| 1930 | |
| 1931 | /// Generates a ready-to-sign digest of human-readable typed data following the EIP-712 standard. |
| 1932 | function eip712HashTypedData(string calldata jsonData) external pure returns (bytes32 digest); |
| 1933 | |
| 1934 | /// Returns ENS namehash for provided string. |
| 1935 | function ensNamehash(string calldata name) external pure returns (bytes32); |
| 1936 | |
| 1937 | /// RLP decodes an RLP payload into a list of bytes. |
| 1938 | function fromRlp(bytes calldata rlp) external pure returns (bytes[] memory data); |
| 1939 | |
| 1940 | /// Gets the label for the specified address. |
| 1941 | function getLabel(address account) external view returns (string memory currentLabel); |
| 1942 | |
| 1943 | /// Labels an address in call traces. |
| 1944 | function label(address account, string calldata newLabel) external; |
| 1945 | |
| 1946 | /// Pauses collection of call traces. Useful in cases when you want to skip tracing of |
| 1947 | /// complex calls which are not useful for debugging. |
| 1948 | function pauseTracing() external view; |
| 1949 | |
| 1950 | /// Returns a random `address`. |
| 1951 | function randomAddress() external view returns (address); |
| 1952 | |
| 1953 | /// Returns a random `bool`. |
| 1954 | function randomBool() external view returns (bool); |
| 1955 | |
| 1956 | /// Returns a random byte array value of the given length. |
| 1957 | function randomBytes(uint256 len) external view returns (bytes memory); |
| 1958 | |
| 1959 | /// Returns a random fixed-size byte array of length 4. |
| 1960 | function randomBytes4() external view returns (bytes4); |
| 1961 | |
| 1962 | /// Returns a random fixed-size byte array of length 8. |
| 1963 | function randomBytes8() external view returns (bytes8); |
| 1964 | |
| 1965 | /// Returns a random `int256` value. |
| 1966 | function randomInt() external view returns (int256); |
| 1967 | |
| 1968 | /// Returns a random `int256` value of given bits. |
| 1969 | function randomInt(uint256 bits) external view returns (int256); |
| 1970 | |
| 1971 | /// Returns a random uint256 value. |
| 1972 | function randomUint() external view returns (uint256); |
| 1973 | |
| 1974 | /// Returns random uint256 value between the provided range (=min..=max). |
| 1975 | function randomUint(uint256 min, uint256 max) external view returns (uint256); |
| 1976 | |
| 1977 | /// Returns a random `uint256` value of given bits. |
| 1978 | function randomUint(uint256 bits) external view returns (uint256); |
| 1979 | |
| 1980 | /// Unpauses collection of call traces. |
| 1981 | function resumeTracing() external view; |
| 1982 | |
| 1983 | /// Utility cheatcode to set arbitrary storage for given target address. |
| 1984 | function setArbitraryStorage(address target) external; |
| 1985 | |
| 1986 | /// Utility cheatcode to set arbitrary storage for given target address and overwrite |
| 1987 | /// any storage slots that have been previously set. |
| 1988 | function setArbitraryStorage(address target, bool overwrite) external; |
| 1989 | |
| 1990 | /// Set RNG seed. |
| 1991 | function setSeed(uint256 seed) external; |
| 1992 | |
| 1993 | /// Randomly shuffles an array. |
| 1994 | function shuffle(uint256[] calldata array) external returns (uint256[] memory); |
| 1995 | |
| 1996 | /// Sorts an array in ascending order. |
| 1997 | function sort(uint256[] calldata array) external returns (uint256[] memory); |
| 1998 | |
| 1999 | /// Encodes a `bytes` value to a base64url string. |
| 2000 | function toBase64URL(bytes calldata data) external pure returns (string memory); |
| 2001 | |
| 2002 | /// Encodes a `string` value to a base64url string. |
| 2003 | function toBase64URL(string calldata data) external pure returns (string memory); |
| 2004 | |
| 2005 | /// Encodes a `bytes` value to a base64 string. |
| 2006 | function toBase64(bytes calldata data) external pure returns (string memory); |
| 2007 | |
| 2008 | /// Encodes a `string` value to a base64 string. |
| 2009 | function toBase64(string calldata data) external pure returns (string memory); |
| 2010 | |
| 2011 | /// RLP encodes a list of bytes into an RLP payload. |
| 2012 | function toRlp(bytes[] calldata data) external pure returns (bytes memory); |
| 2013 | } |
| 2014 | |
| 2015 | /// The `Vm` interface does allow manipulation of the EVM state. These are all intended to be used |
| 2016 | /// in tests, but it is not recommended to use these cheats in scripts. |
| 2017 | interface Vm is VmSafe { |
| 2018 | // ======== EVM ======== |
| 2019 | |
| 2020 | /// Utility cheatcode to set an EIP-2930 access list for all subsequent transactions. |
| 2021 | function accessList(AccessListItem[] calldata access) external; |
| 2022 | |
| 2023 | /// Returns the identifier of the currently active fork. Reverts if no fork is currently active. |
| 2024 | function activeFork() external view returns (uint256 forkId); |
| 2025 | |
| 2026 | /// In forking mode, explicitly grant the given address cheatcode access. |
| 2027 | function allowCheatcodes(address account) external; |
| 2028 | |
| 2029 | /// Sets `block.blobbasefee` |
| 2030 | function blobBaseFee(uint256 newBlobBaseFee) external; |
| 2031 | |
| 2032 | /// Sets the blobhashes in the transaction. |
| 2033 | /// Not available on EVM versions before Cancun. |
| 2034 | /// If used on unsupported EVM versions it will revert. |
| 2035 | function blobhashes(bytes32[] calldata hashes) external; |
| 2036 | |
| 2037 | /// Sets `block.chainid`. |
| 2038 | function chainId(uint256 newChainId) external; |
| 2039 | |
| 2040 | /// Clears all mocked calls. |
| 2041 | function clearMockedCalls() external; |
| 2042 | |
| 2043 | /// Clones a source account code, state, balance and nonce to a target account and updates in-memory EVM state. |
| 2044 | function cloneAccount(address source, address target) external; |
| 2045 | |
| 2046 | /// Sets `block.coinbase`. |
| 2047 | function coinbase(address newCoinbase) external; |
| 2048 | |
| 2049 | /// Marks the slots of an account and the account address as cold. |
| 2050 | function cool(address target) external; |
| 2051 | |
| 2052 | /// Utility cheatcode to mark specific storage slot as cold, simulating no prior read. |
| 2053 | function coolSlot(address target, bytes32 slot) external; |
| 2054 | |
| 2055 | /// Creates a new fork with the given endpoint and the _latest_ block and returns the identifier of the fork. |
| 2056 | function createFork(string calldata urlOrAlias) external returns (uint256 forkId); |
| 2057 | |
| 2058 | /// Creates a new fork with the given endpoint and block and returns the identifier of the fork. |
| 2059 | function createFork(string calldata urlOrAlias, uint256 blockNumber) external returns (uint256 forkId); |
| 2060 | |
| 2061 | /// Creates a new fork with the given endpoint and at the block the given transaction was mined in, |
| 2062 | /// replays all transaction mined in the block before the transaction, and returns the identifier of the fork. |
| 2063 | function createFork(string calldata urlOrAlias, bytes32 txHash) external returns (uint256 forkId); |
| 2064 | |
| 2065 | /// Creates and also selects a new fork with the given endpoint and the latest block and returns the identifier of the fork. |
| 2066 | function createSelectFork(string calldata urlOrAlias) external returns (uint256 forkId); |
| 2067 | |
| 2068 | /// Creates and also selects a new fork with the given endpoint and block and returns the identifier of the fork. |
| 2069 | function createSelectFork(string calldata urlOrAlias, uint256 blockNumber) external returns (uint256 forkId); |
| 2070 | |
| 2071 | /// Creates and also selects new fork with the given endpoint and at the block the given transaction was mined in, |
| 2072 | /// replays all transaction mined in the block before the transaction, returns the identifier of the fork. |
| 2073 | function createSelectFork(string calldata urlOrAlias, bytes32 txHash) external returns (uint256 forkId); |
| 2074 | |
| 2075 | /// Sets an address' balance. |
| 2076 | function deal(address account, uint256 newBalance) external; |
| 2077 | |
| 2078 | /// Removes the snapshot with the given ID created by `snapshot`. |
| 2079 | /// Takes the snapshot ID to delete. |
| 2080 | /// Returns `true` if the snapshot was successfully deleted. |
| 2081 | /// Returns `false` if the snapshot does not exist. |
| 2082 | function deleteStateSnapshot(uint256 snapshotId) external returns (bool success); |
| 2083 | |
| 2084 | /// Removes _all_ snapshots previously created by `snapshot`. |
| 2085 | function deleteStateSnapshots() external; |
| 2086 | |
| 2087 | /// Sets `block.difficulty`. |
| 2088 | /// Not available on EVM versions from Paris onwards. Use `prevrandao` instead. |
| 2089 | /// Reverts if used on unsupported EVM versions. |
| 2090 | function difficulty(uint256 newDifficulty) external; |
| 2091 | |
| 2092 | /// Dump a genesis JSON file's `allocs` to disk. |
| 2093 | function dumpState(string calldata pathToStateJson) external; |
| 2094 | |
| 2095 | /// Sets an address' code. |
| 2096 | function etch(address target, bytes calldata newRuntimeBytecode) external; |
| 2097 | |
| 2098 | /// Sets `block.basefee`. |
| 2099 | function fee(uint256 newBasefee) external; |
| 2100 | |
| 2101 | /// Gets the blockhashes from the current transaction. |
| 2102 | /// Not available on EVM versions before Cancun. |
| 2103 | /// If used on unsupported EVM versions it will revert. |
| 2104 | function getBlobhashes() external view returns (bytes32[] memory hashes); |
| 2105 | |
| 2106 | /// Returns true if the account is marked as persistent. |
| 2107 | function isPersistent(address account) external view returns (bool persistent); |
| 2108 | |
| 2109 | /// Load a genesis JSON file's `allocs` into the in-memory EVM state. |
| 2110 | function loadAllocs(string calldata pathToAllocsJson) external; |
| 2111 | |
| 2112 | /// Marks that the account(s) should use persistent storage across fork swaps in a multifork setup |
| 2113 | /// Meaning, changes made to the state of this account will be kept when switching forks. |
| 2114 | function makePersistent(address account) external; |
| 2115 | |
| 2116 | /// See `makePersistent(address)`. |
| 2117 | function makePersistent(address account0, address account1) external; |
| 2118 | |
| 2119 | /// See `makePersistent(address)`. |
| 2120 | function makePersistent(address account0, address account1, address account2) external; |
| 2121 | |
| 2122 | /// See `makePersistent(address)`. |
| 2123 | function makePersistent(address[] calldata accounts) external; |
| 2124 | |
| 2125 | /// Reverts a call to an address with specified revert data. |
| 2126 | function mockCallRevert(address callee, bytes calldata data, bytes calldata revertData) external; |
| 2127 | |
| 2128 | /// Reverts a call to an address with a specific `msg.value`, with specified revert data. |
| 2129 | function mockCallRevert(address callee, uint256 msgValue, bytes calldata data, bytes calldata revertData) external; |
| 2130 | |
| 2131 | /// Reverts a call to an address with specified revert data. |
| 2132 | /// Overload to pass the function selector directly `token.approve.selector` instead of `abi.encodeWithSelector(token.approve.selector)`. |
| 2133 | function mockCallRevert(address callee, bytes4 data, bytes calldata revertData) external; |
| 2134 | |
| 2135 | /// Reverts a call to an address with a specific `msg.value`, with specified revert data. |
| 2136 | /// Overload to pass the function selector directly `token.approve.selector` instead of `abi.encodeWithSelector(token.approve.selector)`. |
| 2137 | function mockCallRevert(address callee, uint256 msgValue, bytes4 data, bytes calldata revertData) external; |
| 2138 | |
| 2139 | /// Mocks a call to an address, returning specified data. |
| 2140 | /// Calldata can either be strict or a partial match, e.g. if you only |
| 2141 | /// pass a Solidity selector to the expected calldata, then the entire Solidity |
| 2142 | /// function will be mocked. |
| 2143 | function mockCall(address callee, bytes calldata data, bytes calldata returnData) external; |
| 2144 | |
| 2145 | /// Mocks a call to an address with a specific `msg.value`, returning specified data. |
| 2146 | /// Calldata match takes precedence over `msg.value` in case of ambiguity. |
| 2147 | function mockCall(address callee, uint256 msgValue, bytes calldata data, bytes calldata returnData) external; |
| 2148 | |
| 2149 | /// Mocks a call to an address, returning specified data. |
| 2150 | /// Calldata can either be strict or a partial match, e.g. if you only |
| 2151 | /// pass a Solidity selector to the expected calldata, then the entire Solidity |
| 2152 | /// function will be mocked. |
| 2153 | /// Overload to pass the function selector directly `token.approve.selector` instead of `abi.encodeWithSelector(token.approve.selector)`. |
| 2154 | function mockCall(address callee, bytes4 data, bytes calldata returnData) external; |
| 2155 | |
| 2156 | /// Mocks a call to an address with a specific `msg.value`, returning specified data. |
| 2157 | /// Calldata match takes precedence over `msg.value` in case of ambiguity. |
| 2158 | /// Overload to pass the function selector directly `token.approve.selector` instead of `abi.encodeWithSelector(token.approve.selector)`. |
| 2159 | function mockCall(address callee, uint256 msgValue, bytes4 data, bytes calldata returnData) external; |
| 2160 | |
| 2161 | /// Mocks multiple calls to an address, returning specified data for each call. |
| 2162 | function mockCalls(address callee, bytes calldata data, bytes[] calldata returnData) external; |
| 2163 | |
| 2164 | /// Mocks multiple calls to an address with a specific `msg.value`, returning specified data for each call. |
| 2165 | function mockCalls(address callee, uint256 msgValue, bytes calldata data, bytes[] calldata returnData) external; |
| 2166 | |
| 2167 | /// Whenever a call is made to `callee` with calldata `data`, this cheatcode instead calls |
| 2168 | /// `target` with the same calldata. This functionality is similar to a delegate call made to |
| 2169 | /// `target` contract from `callee`. |
| 2170 | /// Can be used to substitute a call to a function with another implementation that captures |
| 2171 | /// the primary logic of the original function but is easier to reason about. |
| 2172 | /// If calldata is not a strict match then partial match by selector is attempted. |
| 2173 | function mockFunction(address callee, address target, bytes calldata data) external; |
| 2174 | |
| 2175 | /// Utility cheatcode to remove any EIP-2930 access list set by `accessList` cheatcode. |
| 2176 | function noAccessList() external; |
| 2177 | |
| 2178 | /// Sets the *next* call's `msg.sender` to be the input address. |
| 2179 | function prank(address msgSender) external; |
| 2180 | |
| 2181 | /// Sets the *next* call's `msg.sender` to be the input address, and the `tx.origin` to be the second input. |
| 2182 | function prank(address msgSender, address txOrigin) external; |
| 2183 | |
| 2184 | /// Sets the *next* delegate call's `msg.sender` to be the input address. |
| 2185 | function prank(address msgSender, bool delegateCall) external; |
| 2186 | |
| 2187 | /// Sets the *next* delegate call's `msg.sender` to be the input address, and the `tx.origin` to be the second input. |
| 2188 | function prank(address msgSender, address txOrigin, bool delegateCall) external; |
| 2189 | |
| 2190 | /// Sets `block.prevrandao`. |
| 2191 | /// Not available on EVM versions before Paris. Use `difficulty` instead. |
| 2192 | /// If used on unsupported EVM versions it will revert. |
| 2193 | function prevrandao(bytes32 newPrevrandao) external; |
| 2194 | |
| 2195 | /// Sets `block.prevrandao`. |
| 2196 | /// Not available on EVM versions before Paris. Use `difficulty` instead. |
| 2197 | /// If used on unsupported EVM versions it will revert. |
| 2198 | function prevrandao(uint256 newPrevrandao) external; |
| 2199 | |
| 2200 | /// Reads the current `msg.sender` and `tx.origin` from state and reports if there is any active caller modification. |
| 2201 | function readCallers() external view returns (CallerMode callerMode, address msgSender, address txOrigin); |
| 2202 | |
| 2203 | /// Resets the nonce of an account to 0 for EOAs and 1 for contract accounts. |
| 2204 | function resetNonce(address account) external; |
| 2205 | |
| 2206 | /// Revert the state of the EVM to a previous snapshot |
| 2207 | /// Takes the snapshot ID to revert to. |
| 2208 | /// Returns `true` if the snapshot was successfully reverted. |
| 2209 | /// Returns `false` if the snapshot does not exist. |
| 2210 | /// **Note:** This does not automatically delete the snapshot. To delete the snapshot use `deleteStateSnapshot`. |
| 2211 | function revertToState(uint256 snapshotId) external returns (bool success); |
| 2212 | |
| 2213 | /// Revert the state of the EVM to a previous snapshot and automatically deletes the snapshots |
| 2214 | /// Takes the snapshot ID to revert to. |
| 2215 | /// Returns `true` if the snapshot was successfully reverted and deleted. |
| 2216 | /// Returns `false` if the snapshot does not exist. |
| 2217 | function revertToStateAndDelete(uint256 snapshotId) external returns (bool success); |
| 2218 | |
| 2219 | /// Revokes persistent status from the address, previously added via `makePersistent`. |
| 2220 | function revokePersistent(address account) external; |
| 2221 | |
| 2222 | /// See `revokePersistent(address)`. |
| 2223 | function revokePersistent(address[] calldata accounts) external; |
| 2224 | |
| 2225 | /// Sets `block.height`. |
| 2226 | function roll(uint256 newHeight) external; |
| 2227 | |
| 2228 | /// Updates the currently active fork to given block number |
| 2229 | /// This is similar to `roll` but for the currently active fork. |
| 2230 | function rollFork(uint256 blockNumber) external; |
| 2231 | |
| 2232 | /// Updates the currently active fork to given transaction. This will `rollFork` with the number |
| 2233 | /// of the block the transaction was mined in and replays all transaction mined before it in the block. |
| 2234 | function rollFork(bytes32 txHash) external; |
| 2235 | |
| 2236 | /// Updates the given fork to given block number. |
| 2237 | function rollFork(uint256 forkId, uint256 blockNumber) external; |
| 2238 | |
| 2239 | /// Updates the given fork to block number of the given transaction and replays all transaction mined before it in the block. |
| 2240 | function rollFork(uint256 forkId, bytes32 txHash) external; |
| 2241 | |
| 2242 | /// Takes a fork identifier created by `createFork` and sets the corresponding forked state as active. |
| 2243 | function selectFork(uint256 forkId) external; |
| 2244 | |
| 2245 | /// Set blockhash for the current block. |
| 2246 | /// It only sets the blockhash for blocks where `block.number - 256 <= number < block.number`. |
| 2247 | function setBlockhash(uint256 blockNumber, bytes32 blockHash) external; |
| 2248 | |
| 2249 | /// Sets the nonce of an account. Must be higher than the current nonce of the account. |
| 2250 | function setNonce(address account, uint64 newNonce) external; |
| 2251 | |
| 2252 | /// Sets the nonce of an account to an arbitrary value. |
| 2253 | function setNonceUnsafe(address account, uint64 newNonce) external; |
| 2254 | |
| 2255 | /// Snapshot capture the gas usage of the last call by name from the callee perspective. |
| 2256 | function snapshotGasLastCall(string calldata name) external returns (uint256 gasUsed); |
| 2257 | |
| 2258 | /// Snapshot capture the gas usage of the last call by name in a group from the callee perspective. |
| 2259 | function snapshotGasLastCall(string calldata group, string calldata name) external returns (uint256 gasUsed); |
| 2260 | |
| 2261 | /// Snapshot the current state of the evm. |
| 2262 | /// Returns the ID of the snapshot that was created. |
| 2263 | /// To revert a snapshot use `revertToState`. |
| 2264 | function snapshotState() external returns (uint256 snapshotId); |
| 2265 | |
| 2266 | /// Snapshot capture an arbitrary numerical value by name. |
| 2267 | /// The group name is derived from the contract name. |
| 2268 | function snapshotValue(string calldata name, uint256 value) external; |
| 2269 | |
| 2270 | /// Snapshot capture an arbitrary numerical value by name in a group. |
| 2271 | function snapshotValue(string calldata group, string calldata name, uint256 value) external; |
| 2272 | |
| 2273 | /// Sets all subsequent calls' `msg.sender` to be the input address until `stopPrank` is called. |
| 2274 | function startPrank(address msgSender) external; |
| 2275 | |
| 2276 | /// Sets all subsequent calls' `msg.sender` to be the input address until `stopPrank` is called, and the `tx.origin` to be the second input. |
| 2277 | function startPrank(address msgSender, address txOrigin) external; |
| 2278 | |
| 2279 | /// Sets all subsequent delegate calls' `msg.sender` to be the input address until `stopPrank` is called. |
| 2280 | function startPrank(address msgSender, bool delegateCall) external; |
| 2281 | |
| 2282 | /// Sets all subsequent delegate calls' `msg.sender` to be the input address until `stopPrank` is called, and the `tx.origin` to be the second input. |
| 2283 | function startPrank(address msgSender, address txOrigin, bool delegateCall) external; |
| 2284 | |
| 2285 | /// Start a snapshot capture of the current gas usage by name. |
| 2286 | /// The group name is derived from the contract name. |
| 2287 | function startSnapshotGas(string calldata name) external; |
| 2288 | |
| 2289 | /// Start a snapshot capture of the current gas usage by name in a group. |
| 2290 | function startSnapshotGas(string calldata group, string calldata name) external; |
| 2291 | |
| 2292 | /// Resets subsequent calls' `msg.sender` to be `address(this)`. |
| 2293 | function stopPrank() external; |
| 2294 | |
| 2295 | /// Stop the snapshot capture of the current gas by latest snapshot name, capturing the gas used since the start. |
| 2296 | function stopSnapshotGas() external returns (uint256 gasUsed); |
| 2297 | |
| 2298 | /// Stop the snapshot capture of the current gas usage by name, capturing the gas used since the start. |
| 2299 | /// The group name is derived from the contract name. |
| 2300 | function stopSnapshotGas(string calldata name) external returns (uint256 gasUsed); |
| 2301 | |
| 2302 | /// Stop the snapshot capture of the current gas usage by name in a group, capturing the gas used since the start. |
| 2303 | function stopSnapshotGas(string calldata group, string calldata name) external returns (uint256 gasUsed); |
| 2304 | |
| 2305 | /// Stores a value to an address' storage slot. |
| 2306 | function store(address target, bytes32 slot, bytes32 value) external; |
| 2307 | |
| 2308 | /// Fetches the given transaction from the active fork and executes it on the current state. |
| 2309 | function transact(bytes32 txHash) external; |
| 2310 | |
| 2311 | /// Fetches the given transaction from the given fork and executes it on the current state. |
| 2312 | function transact(uint256 forkId, bytes32 txHash) external; |
| 2313 | |
| 2314 | /// Sets `tx.gasprice`. |
| 2315 | function txGasPrice(uint256 newGasPrice) external; |
| 2316 | |
| 2317 | /// Utility cheatcode to mark specific storage slot as warm, simulating a prior read. |
| 2318 | function warmSlot(address target, bytes32 slot) external; |
| 2319 | |
| 2320 | /// Sets `block.timestamp`. |
| 2321 | function warp(uint256 newTimestamp) external; |
| 2322 | |
| 2323 | /// `deleteSnapshot` is being deprecated in favor of `deleteStateSnapshot`. It will be removed in future versions. |
| 2324 | function deleteSnapshot(uint256 snapshotId) external returns (bool success); |
| 2325 | |
| 2326 | /// `deleteSnapshots` is being deprecated in favor of `deleteStateSnapshots`. It will be removed in future versions. |
| 2327 | function deleteSnapshots() external; |
| 2328 | |
| 2329 | /// `revertToAndDelete` is being deprecated in favor of `revertToStateAndDelete`. It will be removed in future versions. |
| 2330 | function revertToAndDelete(uint256 snapshotId) external returns (bool success); |
| 2331 | |
| 2332 | /// `revertTo` is being deprecated in favor of `revertToState`. It will be removed in future versions. |
| 2333 | function revertTo(uint256 snapshotId) external returns (bool success); |
| 2334 | |
| 2335 | /// `snapshot` is being deprecated in favor of `snapshotState`. It will be removed in future versions. |
| 2336 | function snapshot() external returns (uint256 snapshotId); |
| 2337 | |
| 2338 | // ======== Testing ======== |
| 2339 | |
| 2340 | /// Expect a call to an address with the specified `msg.value` and calldata, and a *minimum* amount of gas. |
| 2341 | function expectCallMinGas(address callee, uint256 msgValue, uint64 minGas, bytes calldata data) external; |
| 2342 | |
| 2343 | /// Expect given number of calls to an address with the specified `msg.value` and calldata, and a *minimum* amount of gas. |
| 2344 | function expectCallMinGas(address callee, uint256 msgValue, uint64 minGas, bytes calldata data, uint64 count) |
| 2345 | external; |
| 2346 | |
| 2347 | /// Expects a call to an address with the specified calldata. |
| 2348 | /// Calldata can either be a strict or a partial match. |
| 2349 | function expectCall(address callee, bytes calldata data) external; |
| 2350 | |
| 2351 | /// Expects given number of calls to an address with the specified calldata. |
| 2352 | function expectCall(address callee, bytes calldata data, uint64 count) external; |
| 2353 | |
| 2354 | /// Expects a call to an address with the specified `msg.value` and calldata. |
| 2355 | function expectCall(address callee, uint256 msgValue, bytes calldata data) external; |
| 2356 | |
| 2357 | /// Expects given number of calls to an address with the specified `msg.value` and calldata. |
| 2358 | function expectCall(address callee, uint256 msgValue, bytes calldata data, uint64 count) external; |
| 2359 | |
| 2360 | /// Expect a call to an address with the specified `msg.value`, gas, and calldata. |
| 2361 | function expectCall(address callee, uint256 msgValue, uint64 gas, bytes calldata data) external; |
| 2362 | |
| 2363 | /// Expects given number of calls to an address with the specified `msg.value`, gas, and calldata. |
| 2364 | function expectCall(address callee, uint256 msgValue, uint64 gas, bytes calldata data, uint64 count) external; |
| 2365 | |
| 2366 | /// Expects the deployment of the specified bytecode by the specified address using the CREATE opcode |
| 2367 | function expectCreate(bytes calldata bytecode, address deployer) external; |
| 2368 | |
| 2369 | /// Expects the deployment of the specified bytecode by the specified address using the CREATE2 opcode |
| 2370 | function expectCreate2(bytes calldata bytecode, address deployer) external; |
| 2371 | |
| 2372 | /// Prepare an expected anonymous log with (bool checkTopic1, bool checkTopic2, bool checkTopic3, bool checkData.). |
| 2373 | /// Call this function, then emit an anonymous event, then call a function. Internally after the call, we check if |
| 2374 | /// logs were emitted in the expected order with the expected topics and data (as specified by the booleans). |
| 2375 | function expectEmitAnonymous(bool checkTopic0, bool checkTopic1, bool checkTopic2, bool checkTopic3, bool checkData) |
| 2376 | external; |
| 2377 | |
| 2378 | /// Same as the previous method, but also checks supplied address against emitting contract. |
| 2379 | function expectEmitAnonymous( |
| 2380 | bool checkTopic0, |
| 2381 | bool checkTopic1, |
| 2382 | bool checkTopic2, |
| 2383 | bool checkTopic3, |
| 2384 | bool checkData, |
| 2385 | address emitter |
| 2386 | ) external; |
| 2387 | |
| 2388 | /// Prepare an expected anonymous log with all topic and data checks enabled. |
| 2389 | /// Call this function, then emit an anonymous event, then call a function. Internally after the call, we check if |
| 2390 | /// logs were emitted in the expected order with the expected topics and data. |
| 2391 | function expectEmitAnonymous() external; |
| 2392 | |
| 2393 | /// Same as the previous method, but also checks supplied address against emitting contract. |
| 2394 | function expectEmitAnonymous(address emitter) external; |
| 2395 | |
| 2396 | /// Prepare an expected log with (bool checkTopic1, bool checkTopic2, bool checkTopic3, bool checkData.). |
| 2397 | /// Call this function, then emit an event, then call a function. Internally after the call, we check if |
| 2398 | /// logs were emitted in the expected order with the expected topics and data (as specified by the booleans). |
| 2399 | function expectEmit(bool checkTopic1, bool checkTopic2, bool checkTopic3, bool checkData) external; |
| 2400 | |
| 2401 | /// Same as the previous method, but also checks supplied address against emitting contract. |
| 2402 | function expectEmit(bool checkTopic1, bool checkTopic2, bool checkTopic3, bool checkData, address emitter) external; |
| 2403 | |
| 2404 | /// Prepare an expected log with all topic and data checks enabled. |
| 2405 | /// Call this function, then emit an event, then call a function. Internally after the call, we check if |
| 2406 | /// logs were emitted in the expected order with the expected topics and data. |
| 2407 | function expectEmit() external; |
| 2408 | |
| 2409 | /// Same as the previous method, but also checks supplied address against emitting contract. |
| 2410 | function expectEmit(address emitter) external; |
| 2411 | |
| 2412 | /// Expect a given number of logs with the provided topics. |
| 2413 | function expectEmit(bool checkTopic1, bool checkTopic2, bool checkTopic3, bool checkData, uint64 count) external; |
| 2414 | |
| 2415 | /// Expect a given number of logs from a specific emitter with the provided topics. |
| 2416 | function expectEmit( |
| 2417 | bool checkTopic1, |
| 2418 | bool checkTopic2, |
| 2419 | bool checkTopic3, |
| 2420 | bool checkData, |
| 2421 | address emitter, |
| 2422 | uint64 count |
| 2423 | ) external; |
| 2424 | |
| 2425 | /// Expect a given number of logs with all topic and data checks enabled. |
| 2426 | function expectEmit(uint64 count) external; |
| 2427 | |
| 2428 | /// Expect a given number of logs from a specific emitter with all topic and data checks enabled. |
| 2429 | function expectEmit(address emitter, uint64 count) external; |
| 2430 | |
| 2431 | /// Expects an error on next call that starts with the revert data. |
| 2432 | function expectPartialRevert(bytes4 revertData) external; |
| 2433 | |
| 2434 | /// Expects an error on next call to reverter address, that starts with the revert data. |
| 2435 | function expectPartialRevert(bytes4 revertData, address reverter) external; |
| 2436 | |
| 2437 | /// Expects an error on next call with any revert data. |
| 2438 | function expectRevert() external; |
| 2439 | |
| 2440 | /// Expects an error on next call that exactly matches the revert data. |
| 2441 | function expectRevert(bytes4 revertData) external; |
| 2442 | |
| 2443 | /// Expects a `count` number of reverts from the upcoming calls from the reverter address that match the revert data. |
| 2444 | function expectRevert(bytes4 revertData, address reverter, uint64 count) external; |
| 2445 | |
| 2446 | /// Expects a `count` number of reverts from the upcoming calls from the reverter address that exactly match the revert data. |
| 2447 | function expectRevert(bytes calldata revertData, address reverter, uint64 count) external; |
| 2448 | |
| 2449 | /// Expects an error on next call that exactly matches the revert data. |
| 2450 | function expectRevert(bytes calldata revertData) external; |
| 2451 | |
| 2452 | /// Expects an error with any revert data on next call to reverter address. |
| 2453 | function expectRevert(address reverter) external; |
| 2454 | |
| 2455 | /// Expects an error from reverter address on next call, with any revert data. |
| 2456 | function expectRevert(bytes4 revertData, address reverter) external; |
| 2457 | |
| 2458 | /// Expects an error from reverter address on next call, that exactly matches the revert data. |
| 2459 | function expectRevert(bytes calldata revertData, address reverter) external; |
| 2460 | |
| 2461 | /// Expects a `count` number of reverts from the upcoming calls with any revert data or reverter. |
| 2462 | function expectRevert(uint64 count) external; |
| 2463 | |
| 2464 | /// Expects a `count` number of reverts from the upcoming calls that match the revert data. |
| 2465 | function expectRevert(bytes4 revertData, uint64 count) external; |
| 2466 | |
| 2467 | /// Expects a `count` number of reverts from the upcoming calls that exactly match the revert data. |
| 2468 | function expectRevert(bytes calldata revertData, uint64 count) external; |
| 2469 | |
| 2470 | /// Expects a `count` number of reverts from the upcoming calls from the reverter address. |
| 2471 | function expectRevert(address reverter, uint64 count) external; |
| 2472 | |
| 2473 | /// Only allows memory writes to offsets [0x00, 0x60) ∪ [min, max) in the current subcontext. If any other |
| 2474 | /// memory is written to, the test will fail. Can be called multiple times to add more ranges to the set. |
| 2475 | function expectSafeMemory(uint64 min, uint64 max) external; |
| 2476 | |
| 2477 | /// Only allows memory writes to offsets [0x00, 0x60) ∪ [min, max) in the next created subcontext. |
| 2478 | /// If any other memory is written to, the test will fail. Can be called multiple times to add more ranges |
| 2479 | /// to the set. |
| 2480 | function expectSafeMemoryCall(uint64 min, uint64 max) external; |
| 2481 | |
| 2482 | /// Marks a test as skipped. Must be called at the top level of a test. |
| 2483 | function skip(bool skipTest) external; |
| 2484 | |
| 2485 | /// Marks a test as skipped with a reason. Must be called at the top level of a test. |
| 2486 | function skip(bool skipTest, string calldata reason) external; |
| 2487 | |
| 2488 | /// Stops all safe memory expectation in the current subcontext. |
| 2489 | function stopExpectSafeMemory() external; |
| 2490 | |
| 2491 | // ======== Utilities ======== |
| 2492 | |
| 2493 | /// Causes the next contract creation (via new) to fail and return its initcode in the returndata buffer. |
| 2494 | /// This allows type-safe access to the initcode payload that would be used for contract creation. |
| 2495 | /// Example usage: |
| 2496 | /// vm.interceptInitcode(); |
| 2497 | /// bytes memory initcode; |
| 2498 | /// try new MyContract(param1, param2) { assert(false); } |
| 2499 | /// catch (bytes memory interceptedInitcode) { initcode = interceptedInitcode; } |
| 2500 | function interceptInitcode() external; |
| 2501 | } |
| 2502 |
0.0%
lib/forge-std/src/console.sol
Lines covered: 0 / 1 (0.0%)
| 1 | // SPDX-License-Identifier: MIT |
| 2 | pragma solidity >=0.4.22 <0.9.0; |
| 3 | |
| 4 | library console { |
| 5 | address constant CONSOLE_ADDRESS = |
| 6 | 0x000000000000000000636F6e736F6c652e6c6f67; |
| 7 | |
| 8 | function _sendLogPayloadImplementation(bytes memory payload) internal view { |
| 9 | address consoleAddress = CONSOLE_ADDRESS; |
| 10 | /// @solidity memory-safe-assembly |
| 11 | assembly { |
| 12 | pop( |
| 13 | staticcall( |
| 14 | gas(), |
| 15 | consoleAddress, |
| 16 | add(payload, 32), |
| 17 | mload(payload), |
| 18 | 0, |
| 19 | 0 |
| 20 | ) |
| 21 | ) |
| 22 | } |
| 23 | } |
| 24 | |
| 25 | function _castToPure( |
| 26 | function(bytes memory) internal view fnIn |
| 27 | ) internal pure returns (function(bytes memory) pure fnOut) { |
| 28 | assembly { |
| 29 | fnOut := fnIn |
| 30 | } |
| 31 | } |
| 32 | |
| 33 | function _sendLogPayload(bytes memory payload) internal pure { |
| 34 | _castToPure(_sendLogPayloadImplementation)(payload); |
| 35 | } |
| 36 | |
| 37 | function log() internal pure { |
| 38 | _sendLogPayload(abi.encodeWithSignature("log()")); |
| 39 | } |
| 40 | |
| 41 | function logInt(int256 p0) internal pure { |
| 42 | _sendLogPayload(abi.encodeWithSignature("log(int256)", p0)); |
| 43 | } |
| 44 | |
| 45 | function logUint(uint256 p0) internal pure { |
| 46 | _sendLogPayload(abi.encodeWithSignature("log(uint256)", p0)); |
| 47 | } |
| 48 | |
| 49 | function logString(string memory p0) internal pure { |
| 50 | _sendLogPayload(abi.encodeWithSignature("log(string)", p0)); |
| 51 | } |
| 52 | |
| 53 | function logBool(bool p0) internal pure { |
| 54 | _sendLogPayload(abi.encodeWithSignature("log(bool)", p0)); |
| 55 | } |
| 56 | |
| 57 | function logAddress(address p0) internal pure { |
| 58 | _sendLogPayload(abi.encodeWithSignature("log(address)", p0)); |
| 59 | } |
| 60 | |
| 61 | function logBytes(bytes memory p0) internal pure { |
| 62 | _sendLogPayload(abi.encodeWithSignature("log(bytes)", p0)); |
| 63 | } |
| 64 | |
| 65 | function logBytes1(bytes1 p0) internal pure { |
| 66 | _sendLogPayload(abi.encodeWithSignature("log(bytes1)", p0)); |
| 67 | } |
| 68 | |
| 69 | function logBytes2(bytes2 p0) internal pure { |
| 70 | _sendLogPayload(abi.encodeWithSignature("log(bytes2)", p0)); |
| 71 | } |
| 72 | |
| 73 | function logBytes3(bytes3 p0) internal pure { |
| 74 | _sendLogPayload(abi.encodeWithSignature("log(bytes3)", p0)); |
| 75 | } |
| 76 | |
| 77 | function logBytes4(bytes4 p0) internal pure { |
| 78 | _sendLogPayload(abi.encodeWithSignature("log(bytes4)", p0)); |
| 79 | } |
| 80 | |
| 81 | function logBytes5(bytes5 p0) internal pure { |
| 82 | _sendLogPayload(abi.encodeWithSignature("log(bytes5)", p0)); |
| 83 | } |
| 84 | |
| 85 | function logBytes6(bytes6 p0) internal pure { |
| 86 | _sendLogPayload(abi.encodeWithSignature("log(bytes6)", p0)); |
| 87 | } |
| 88 | |
| 89 | function logBytes7(bytes7 p0) internal pure { |
| 90 | _sendLogPayload(abi.encodeWithSignature("log(bytes7)", p0)); |
| 91 | } |
| 92 | |
| 93 | function logBytes8(bytes8 p0) internal pure { |
| 94 | _sendLogPayload(abi.encodeWithSignature("log(bytes8)", p0)); |
| 95 | } |
| 96 | |
| 97 | function logBytes9(bytes9 p0) internal pure { |
| 98 | _sendLogPayload(abi.encodeWithSignature("log(bytes9)", p0)); |
| 99 | } |
| 100 | |
| 101 | function logBytes10(bytes10 p0) internal pure { |
| 102 | _sendLogPayload(abi.encodeWithSignature("log(bytes10)", p0)); |
| 103 | } |
| 104 | |
| 105 | function logBytes11(bytes11 p0) internal pure { |
| 106 | _sendLogPayload(abi.encodeWithSignature("log(bytes11)", p0)); |
| 107 | } |
| 108 | |
| 109 | function logBytes12(bytes12 p0) internal pure { |
| 110 | _sendLogPayload(abi.encodeWithSignature("log(bytes12)", p0)); |
| 111 | } |
| 112 | |
| 113 | function logBytes13(bytes13 p0) internal pure { |
| 114 | _sendLogPayload(abi.encodeWithSignature("log(bytes13)", p0)); |
| 115 | } |
| 116 | |
| 117 | function logBytes14(bytes14 p0) internal pure { |
| 118 | _sendLogPayload(abi.encodeWithSignature("log(bytes14)", p0)); |
| 119 | } |
| 120 | |
| 121 | function logBytes15(bytes15 p0) internal pure { |
| 122 | _sendLogPayload(abi.encodeWithSignature("log(bytes15)", p0)); |
| 123 | } |
| 124 | |
| 125 | function logBytes16(bytes16 p0) internal pure { |
| 126 | _sendLogPayload(abi.encodeWithSignature("log(bytes16)", p0)); |
| 127 | } |
| 128 | |
| 129 | function logBytes17(bytes17 p0) internal pure { |
| 130 | _sendLogPayload(abi.encodeWithSignature("log(bytes17)", p0)); |
| 131 | } |
| 132 | |
| 133 | function logBytes18(bytes18 p0) internal pure { |
| 134 | _sendLogPayload(abi.encodeWithSignature("log(bytes18)", p0)); |
| 135 | } |
| 136 | |
| 137 | function logBytes19(bytes19 p0) internal pure { |
| 138 | _sendLogPayload(abi.encodeWithSignature("log(bytes19)", p0)); |
| 139 | } |
| 140 | |
| 141 | function logBytes20(bytes20 p0) internal pure { |
| 142 | _sendLogPayload(abi.encodeWithSignature("log(bytes20)", p0)); |
| 143 | } |
| 144 | |
| 145 | function logBytes21(bytes21 p0) internal pure { |
| 146 | _sendLogPayload(abi.encodeWithSignature("log(bytes21)", p0)); |
| 147 | } |
| 148 | |
| 149 | function logBytes22(bytes22 p0) internal pure { |
| 150 | _sendLogPayload(abi.encodeWithSignature("log(bytes22)", p0)); |
| 151 | } |
| 152 | |
| 153 | function logBytes23(bytes23 p0) internal pure { |
| 154 | _sendLogPayload(abi.encodeWithSignature("log(bytes23)", p0)); |
| 155 | } |
| 156 | |
| 157 | function logBytes24(bytes24 p0) internal pure { |
| 158 | _sendLogPayload(abi.encodeWithSignature("log(bytes24)", p0)); |
| 159 | } |
| 160 | |
| 161 | function logBytes25(bytes25 p0) internal pure { |
| 162 | _sendLogPayload(abi.encodeWithSignature("log(bytes25)", p0)); |
| 163 | } |
| 164 | |
| 165 | function logBytes26(bytes26 p0) internal pure { |
| 166 | _sendLogPayload(abi.encodeWithSignature("log(bytes26)", p0)); |
| 167 | } |
| 168 | |
| 169 | function logBytes27(bytes27 p0) internal pure { |
| 170 | _sendLogPayload(abi.encodeWithSignature("log(bytes27)", p0)); |
| 171 | } |
| 172 | |
| 173 | function logBytes28(bytes28 p0) internal pure { |
| 174 | _sendLogPayload(abi.encodeWithSignature("log(bytes28)", p0)); |
| 175 | } |
| 176 | |
| 177 | function logBytes29(bytes29 p0) internal pure { |
| 178 | _sendLogPayload(abi.encodeWithSignature("log(bytes29)", p0)); |
| 179 | } |
| 180 | |
| 181 | function logBytes30(bytes30 p0) internal pure { |
| 182 | _sendLogPayload(abi.encodeWithSignature("log(bytes30)", p0)); |
| 183 | } |
| 184 | |
| 185 | function logBytes31(bytes31 p0) internal pure { |
| 186 | _sendLogPayload(abi.encodeWithSignature("log(bytes31)", p0)); |
| 187 | } |
| 188 | |
| 189 | function logBytes32(bytes32 p0) internal pure { |
| 190 | _sendLogPayload(abi.encodeWithSignature("log(bytes32)", p0)); |
| 191 | } |
| 192 | |
| 193 | function log(uint256 p0) internal pure { |
| 194 | _sendLogPayload(abi.encodeWithSignature("log(uint256)", p0)); |
| 195 | } |
| 196 | |
| 197 | function log(int256 p0) internal pure { |
| 198 | _sendLogPayload(abi.encodeWithSignature("log(int256)", p0)); |
| 199 | } |
| 200 | |
| 201 | function log(string memory p0) internal pure { |
| 202 | _sendLogPayload(abi.encodeWithSignature("log(string)", p0)); |
| 203 | } |
| 204 | |
| 205 | function log(bool p0) internal pure { |
| 206 | _sendLogPayload(abi.encodeWithSignature("log(bool)", p0)); |
| 207 | } |
| 208 | |
| 209 | function log(address p0) internal pure { |
| 210 | _sendLogPayload(abi.encodeWithSignature("log(address)", p0)); |
| 211 | } |
| 212 | |
| 213 | function log(uint256 p0, uint256 p1) internal pure { |
| 214 | _sendLogPayload(abi.encodeWithSignature("log(uint256,uint256)", p0, p1)); |
| 215 | } |
| 216 | |
| 217 | function log(uint256 p0, string memory p1) internal pure { |
| 218 | _sendLogPayload(abi.encodeWithSignature("log(uint256,string)", p0, p1)); |
| 219 | } |
| 220 | |
| 221 | function log(uint256 p0, bool p1) internal pure { |
| 222 | _sendLogPayload(abi.encodeWithSignature("log(uint256,bool)", p0, p1)); |
| 223 | } |
| 224 | |
| 225 | function log(uint256 p0, address p1) internal pure { |
| 226 | _sendLogPayload(abi.encodeWithSignature("log(uint256,address)", p0, p1)); |
| 227 | } |
| 228 | |
| 229 | function log(string memory p0, uint256 p1) internal pure { |
| 230 | _sendLogPayload(abi.encodeWithSignature("log(string,uint256)", p0, p1)); |
| 231 | } |
| 232 | |
| 233 | function log(string memory p0, int256 p1) internal pure { |
| 234 | _sendLogPayload(abi.encodeWithSignature("log(string,int256)", p0, p1)); |
| 235 | } |
| 236 | |
| 237 | function log(string memory p0, string memory p1) internal pure { |
| 238 | _sendLogPayload(abi.encodeWithSignature("log(string,string)", p0, p1)); |
| 239 | } |
| 240 | |
| 241 | function log(string memory p0, bool p1) internal pure { |
| 242 | _sendLogPayload(abi.encodeWithSignature("log(string,bool)", p0, p1)); |
| 243 | } |
| 244 | |
| 245 | function log(string memory p0, address p1) internal pure { |
| 246 | _sendLogPayload(abi.encodeWithSignature("log(string,address)", p0, p1)); |
| 247 | } |
| 248 | |
| 249 | function log(bool p0, uint256 p1) internal pure { |
| 250 | _sendLogPayload(abi.encodeWithSignature("log(bool,uint256)", p0, p1)); |
| 251 | } |
| 252 | |
| 253 | function log(bool p0, string memory p1) internal pure { |
| 254 | _sendLogPayload(abi.encodeWithSignature("log(bool,string)", p0, p1)); |
| 255 | } |
| 256 | |
| 257 | function log(bool p0, bool p1) internal pure { |
| 258 | _sendLogPayload(abi.encodeWithSignature("log(bool,bool)", p0, p1)); |
| 259 | } |
| 260 | |
| 261 | function log(bool p0, address p1) internal pure { |
| 262 | _sendLogPayload(abi.encodeWithSignature("log(bool,address)", p0, p1)); |
| 263 | } |
| 264 | |
| 265 | function log(address p0, uint256 p1) internal pure { |
| 266 | _sendLogPayload(abi.encodeWithSignature("log(address,uint256)", p0, p1)); |
| 267 | } |
| 268 | |
| 269 | function log(address p0, string memory p1) internal pure { |
| 270 | _sendLogPayload(abi.encodeWithSignature("log(address,string)", p0, p1)); |
| 271 | } |
| 272 | |
| 273 | function log(address p0, bool p1) internal pure { |
| 274 | _sendLogPayload(abi.encodeWithSignature("log(address,bool)", p0, p1)); |
| 275 | } |
| 276 | |
| 277 | function log(address p0, address p1) internal pure { |
| 278 | _sendLogPayload(abi.encodeWithSignature("log(address,address)", p0, p1)); |
| 279 | } |
| 280 | |
| 281 | function log(uint256 p0, uint256 p1, uint256 p2) internal pure { |
| 282 | _sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,uint256)", p0, p1, p2)); |
| 283 | } |
| 284 | |
| 285 | function log(uint256 p0, uint256 p1, string memory p2) internal pure { |
| 286 | _sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,string)", p0, p1, p2)); |
| 287 | } |
| 288 | |
| 289 | function log(uint256 p0, uint256 p1, bool p2) internal pure { |
| 290 | _sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,bool)", p0, p1, p2)); |
| 291 | } |
| 292 | |
| 293 | function log(uint256 p0, uint256 p1, address p2) internal pure { |
| 294 | _sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,address)", p0, p1, p2)); |
| 295 | } |
| 296 | |
| 297 | function log(uint256 p0, string memory p1, uint256 p2) internal pure { |
| 298 | _sendLogPayload(abi.encodeWithSignature("log(uint256,string,uint256)", p0, p1, p2)); |
| 299 | } |
| 300 | |
| 301 | function log(uint256 p0, string memory p1, string memory p2) internal pure { |
| 302 | _sendLogPayload(abi.encodeWithSignature("log(uint256,string,string)", p0, p1, p2)); |
| 303 | } |
| 304 | |
| 305 | function log(uint256 p0, string memory p1, bool p2) internal pure { |
| 306 | _sendLogPayload(abi.encodeWithSignature("log(uint256,string,bool)", p0, p1, p2)); |
| 307 | } |
| 308 | |
| 309 | function log(uint256 p0, string memory p1, address p2) internal pure { |
| 310 | _sendLogPayload(abi.encodeWithSignature("log(uint256,string,address)", p0, p1, p2)); |
| 311 | } |
| 312 | |
| 313 | function log(uint256 p0, bool p1, uint256 p2) internal pure { |
| 314 | _sendLogPayload(abi.encodeWithSignature("log(uint256,bool,uint256)", p0, p1, p2)); |
| 315 | } |
| 316 | |
| 317 | function log(uint256 p0, bool p1, string memory p2) internal pure { |
| 318 | _sendLogPayload(abi.encodeWithSignature("log(uint256,bool,string)", p0, p1, p2)); |
| 319 | } |
| 320 | |
| 321 | function log(uint256 p0, bool p1, bool p2) internal pure { |
| 322 | _sendLogPayload(abi.encodeWithSignature("log(uint256,bool,bool)", p0, p1, p2)); |
| 323 | } |
| 324 | |
| 325 | function log(uint256 p0, bool p1, address p2) internal pure { |
| 326 | _sendLogPayload(abi.encodeWithSignature("log(uint256,bool,address)", p0, p1, p2)); |
| 327 | } |
| 328 | |
| 329 | function log(uint256 p0, address p1, uint256 p2) internal pure { |
| 330 | _sendLogPayload(abi.encodeWithSignature("log(uint256,address,uint256)", p0, p1, p2)); |
| 331 | } |
| 332 | |
| 333 | function log(uint256 p0, address p1, string memory p2) internal pure { |
| 334 | _sendLogPayload(abi.encodeWithSignature("log(uint256,address,string)", p0, p1, p2)); |
| 335 | } |
| 336 | |
| 337 | function log(uint256 p0, address p1, bool p2) internal pure { |
| 338 | _sendLogPayload(abi.encodeWithSignature("log(uint256,address,bool)", p0, p1, p2)); |
| 339 | } |
| 340 | |
| 341 | function log(uint256 p0, address p1, address p2) internal pure { |
| 342 | _sendLogPayload(abi.encodeWithSignature("log(uint256,address,address)", p0, p1, p2)); |
| 343 | } |
| 344 | |
| 345 | function log(string memory p0, uint256 p1, uint256 p2) internal pure { |
| 346 | _sendLogPayload(abi.encodeWithSignature("log(string,uint256,uint256)", p0, p1, p2)); |
| 347 | } |
| 348 | |
| 349 | function log(string memory p0, uint256 p1, string memory p2) internal pure { |
| 350 | _sendLogPayload(abi.encodeWithSignature("log(string,uint256,string)", p0, p1, p2)); |
| 351 | } |
| 352 | |
| 353 | function log(string memory p0, uint256 p1, bool p2) internal pure { |
| 354 | _sendLogPayload(abi.encodeWithSignature("log(string,uint256,bool)", p0, p1, p2)); |
| 355 | } |
| 356 | |
| 357 | function log(string memory p0, uint256 p1, address p2) internal pure { |
| 358 | _sendLogPayload(abi.encodeWithSignature("log(string,uint256,address)", p0, p1, p2)); |
| 359 | } |
| 360 | |
| 361 | function log(string memory p0, string memory p1, uint256 p2) internal pure { |
| 362 | _sendLogPayload(abi.encodeWithSignature("log(string,string,uint256)", p0, p1, p2)); |
| 363 | } |
| 364 | |
| 365 | function log(string memory p0, string memory p1, string memory p2) internal pure { |
| 366 | _sendLogPayload(abi.encodeWithSignature("log(string,string,string)", p0, p1, p2)); |
| 367 | } |
| 368 | |
| 369 | function log(string memory p0, string memory p1, bool p2) internal pure { |
| 370 | _sendLogPayload(abi.encodeWithSignature("log(string,string,bool)", p0, p1, p2)); |
| 371 | } |
| 372 | |
| 373 | function log(string memory p0, string memory p1, address p2) internal pure { |
| 374 | _sendLogPayload(abi.encodeWithSignature("log(string,string,address)", p0, p1, p2)); |
| 375 | } |
| 376 | |
| 377 | function log(string memory p0, bool p1, uint256 p2) internal pure { |
| 378 | _sendLogPayload(abi.encodeWithSignature("log(string,bool,uint256)", p0, p1, p2)); |
| 379 | } |
| 380 | |
| 381 | function log(string memory p0, bool p1, string memory p2) internal pure { |
| 382 | _sendLogPayload(abi.encodeWithSignature("log(string,bool,string)", p0, p1, p2)); |
| 383 | } |
| 384 | |
| 385 | function log(string memory p0, bool p1, bool p2) internal pure { |
| 386 | _sendLogPayload(abi.encodeWithSignature("log(string,bool,bool)", p0, p1, p2)); |
| 387 | } |
| 388 | |
| 389 | function log(string memory p0, bool p1, address p2) internal pure { |
| 390 | _sendLogPayload(abi.encodeWithSignature("log(string,bool,address)", p0, p1, p2)); |
| 391 | } |
| 392 | |
| 393 | function log(string memory p0, address p1, uint256 p2) internal pure { |
| 394 | _sendLogPayload(abi.encodeWithSignature("log(string,address,uint256)", p0, p1, p2)); |
| 395 | } |
| 396 | |
| 397 | function log(string memory p0, address p1, string memory p2) internal pure { |
| 398 | _sendLogPayload(abi.encodeWithSignature("log(string,address,string)", p0, p1, p2)); |
| 399 | } |
| 400 | |
| 401 | function log(string memory p0, address p1, bool p2) internal pure { |
| 402 | _sendLogPayload(abi.encodeWithSignature("log(string,address,bool)", p0, p1, p2)); |
| 403 | } |
| 404 | |
| 405 | function log(string memory p0, address p1, address p2) internal pure { |
| 406 | _sendLogPayload(abi.encodeWithSignature("log(string,address,address)", p0, p1, p2)); |
| 407 | } |
| 408 | |
| 409 | function log(bool p0, uint256 p1, uint256 p2) internal pure { |
| 410 | _sendLogPayload(abi.encodeWithSignature("log(bool,uint256,uint256)", p0, p1, p2)); |
| 411 | } |
| 412 | |
| 413 | function log(bool p0, uint256 p1, string memory p2) internal pure { |
| 414 | _sendLogPayload(abi.encodeWithSignature("log(bool,uint256,string)", p0, p1, p2)); |
| 415 | } |
| 416 | |
| 417 | function log(bool p0, uint256 p1, bool p2) internal pure { |
| 418 | _sendLogPayload(abi.encodeWithSignature("log(bool,uint256,bool)", p0, p1, p2)); |
| 419 | } |
| 420 | |
| 421 | function log(bool p0, uint256 p1, address p2) internal pure { |
| 422 | _sendLogPayload(abi.encodeWithSignature("log(bool,uint256,address)", p0, p1, p2)); |
| 423 | } |
| 424 | |
| 425 | function log(bool p0, string memory p1, uint256 p2) internal pure { |
| 426 | _sendLogPayload(abi.encodeWithSignature("log(bool,string,uint256)", p0, p1, p2)); |
| 427 | } |
| 428 | |
| 429 | function log(bool p0, string memory p1, string memory p2) internal pure { |
| 430 | _sendLogPayload(abi.encodeWithSignature("log(bool,string,string)", p0, p1, p2)); |
| 431 | } |
| 432 | |
| 433 | function log(bool p0, string memory p1, bool p2) internal pure { |
| 434 | _sendLogPayload(abi.encodeWithSignature("log(bool,string,bool)", p0, p1, p2)); |
| 435 | } |
| 436 | |
| 437 | function log(bool p0, string memory p1, address p2) internal pure { |
| 438 | _sendLogPayload(abi.encodeWithSignature("log(bool,string,address)", p0, p1, p2)); |
| 439 | } |
| 440 | |
| 441 | function log(bool p0, bool p1, uint256 p2) internal pure { |
| 442 | _sendLogPayload(abi.encodeWithSignature("log(bool,bool,uint256)", p0, p1, p2)); |
| 443 | } |
| 444 | |
| 445 | function log(bool p0, bool p1, string memory p2) internal pure { |
| 446 | _sendLogPayload(abi.encodeWithSignature("log(bool,bool,string)", p0, p1, p2)); |
| 447 | } |
| 448 | |
| 449 | function log(bool p0, bool p1, bool p2) internal pure { |
| 450 | _sendLogPayload(abi.encodeWithSignature("log(bool,bool,bool)", p0, p1, p2)); |
| 451 | } |
| 452 | |
| 453 | function log(bool p0, bool p1, address p2) internal pure { |
| 454 | _sendLogPayload(abi.encodeWithSignature("log(bool,bool,address)", p0, p1, p2)); |
| 455 | } |
| 456 | |
| 457 | function log(bool p0, address p1, uint256 p2) internal pure { |
| 458 | _sendLogPayload(abi.encodeWithSignature("log(bool,address,uint256)", p0, p1, p2)); |
| 459 | } |
| 460 | |
| 461 | function log(bool p0, address p1, string memory p2) internal pure { |
| 462 | _sendLogPayload(abi.encodeWithSignature("log(bool,address,string)", p0, p1, p2)); |
| 463 | } |
| 464 | |
| 465 | function log(bool p0, address p1, bool p2) internal pure { |
| 466 | _sendLogPayload(abi.encodeWithSignature("log(bool,address,bool)", p0, p1, p2)); |
| 467 | } |
| 468 | |
| 469 | function log(bool p0, address p1, address p2) internal pure { |
| 470 | _sendLogPayload(abi.encodeWithSignature("log(bool,address,address)", p0, p1, p2)); |
| 471 | } |
| 472 | |
| 473 | function log(address p0, uint256 p1, uint256 p2) internal pure { |
| 474 | _sendLogPayload(abi.encodeWithSignature("log(address,uint256,uint256)", p0, p1, p2)); |
| 475 | } |
| 476 | |
| 477 | function log(address p0, uint256 p1, string memory p2) internal pure { |
| 478 | _sendLogPayload(abi.encodeWithSignature("log(address,uint256,string)", p0, p1, p2)); |
| 479 | } |
| 480 | |
| 481 | function log(address p0, uint256 p1, bool p2) internal pure { |
| 482 | _sendLogPayload(abi.encodeWithSignature("log(address,uint256,bool)", p0, p1, p2)); |
| 483 | } |
| 484 | |
| 485 | function log(address p0, uint256 p1, address p2) internal pure { |
| 486 | _sendLogPayload(abi.encodeWithSignature("log(address,uint256,address)", p0, p1, p2)); |
| 487 | } |
| 488 | |
| 489 | function log(address p0, string memory p1, uint256 p2) internal pure { |
| 490 | _sendLogPayload(abi.encodeWithSignature("log(address,string,uint256)", p0, p1, p2)); |
| 491 | } |
| 492 | |
| 493 | function log(address p0, string memory p1, string memory p2) internal pure { |
| 494 | _sendLogPayload(abi.encodeWithSignature("log(address,string,string)", p0, p1, p2)); |
| 495 | } |
| 496 | |
| 497 | function log(address p0, string memory p1, bool p2) internal pure { |
| 498 | _sendLogPayload(abi.encodeWithSignature("log(address,string,bool)", p0, p1, p2)); |
| 499 | } |
| 500 | |
| 501 | function log(address p0, string memory p1, address p2) internal pure { |
| 502 | _sendLogPayload(abi.encodeWithSignature("log(address,string,address)", p0, p1, p2)); |
| 503 | } |
| 504 | |
| 505 | function log(address p0, bool p1, uint256 p2) internal pure { |
| 506 | _sendLogPayload(abi.encodeWithSignature("log(address,bool,uint256)", p0, p1, p2)); |
| 507 | } |
| 508 | |
| 509 | function log(address p0, bool p1, string memory p2) internal pure { |
| 510 | _sendLogPayload(abi.encodeWithSignature("log(address,bool,string)", p0, p1, p2)); |
| 511 | } |
| 512 | |
| 513 | function log(address p0, bool p1, bool p2) internal pure { |
| 514 | _sendLogPayload(abi.encodeWithSignature("log(address,bool,bool)", p0, p1, p2)); |
| 515 | } |
| 516 | |
| 517 | function log(address p0, bool p1, address p2) internal pure { |
| 518 | _sendLogPayload(abi.encodeWithSignature("log(address,bool,address)", p0, p1, p2)); |
| 519 | } |
| 520 | |
| 521 | function log(address p0, address p1, uint256 p2) internal pure { |
| 522 | _sendLogPayload(abi.encodeWithSignature("log(address,address,uint256)", p0, p1, p2)); |
| 523 | } |
| 524 | |
| 525 | function log(address p0, address p1, string memory p2) internal pure { |
| 526 | _sendLogPayload(abi.encodeWithSignature("log(address,address,string)", p0, p1, p2)); |
| 527 | } |
| 528 | |
| 529 | function log(address p0, address p1, bool p2) internal pure { |
| 530 | _sendLogPayload(abi.encodeWithSignature("log(address,address,bool)", p0, p1, p2)); |
| 531 | } |
| 532 | |
| 533 | function log(address p0, address p1, address p2) internal pure { |
| 534 | _sendLogPayload(abi.encodeWithSignature("log(address,address,address)", p0, p1, p2)); |
| 535 | } |
| 536 | |
| 537 | function log(uint256 p0, uint256 p1, uint256 p2, uint256 p3) internal pure { |
| 538 | _sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,uint256,uint256)", p0, p1, p2, p3)); |
| 539 | } |
| 540 | |
| 541 | function log(uint256 p0, uint256 p1, uint256 p2, string memory p3) internal pure { |
| 542 | _sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,uint256,string)", p0, p1, p2, p3)); |
| 543 | } |
| 544 | |
| 545 | function log(uint256 p0, uint256 p1, uint256 p2, bool p3) internal pure { |
| 546 | _sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,uint256,bool)", p0, p1, p2, p3)); |
| 547 | } |
| 548 | |
| 549 | function log(uint256 p0, uint256 p1, uint256 p2, address p3) internal pure { |
| 550 | _sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,uint256,address)", p0, p1, p2, p3)); |
| 551 | } |
| 552 | |
| 553 | function log(uint256 p0, uint256 p1, string memory p2, uint256 p3) internal pure { |
| 554 | _sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,string,uint256)", p0, p1, p2, p3)); |
| 555 | } |
| 556 | |
| 557 | function log(uint256 p0, uint256 p1, string memory p2, string memory p3) internal pure { |
| 558 | _sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,string,string)", p0, p1, p2, p3)); |
| 559 | } |
| 560 | |
| 561 | function log(uint256 p0, uint256 p1, string memory p2, bool p3) internal pure { |
| 562 | _sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,string,bool)", p0, p1, p2, p3)); |
| 563 | } |
| 564 | |
| 565 | function log(uint256 p0, uint256 p1, string memory p2, address p3) internal pure { |
| 566 | _sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,string,address)", p0, p1, p2, p3)); |
| 567 | } |
| 568 | |
| 569 | function log(uint256 p0, uint256 p1, bool p2, uint256 p3) internal pure { |
| 570 | _sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,bool,uint256)", p0, p1, p2, p3)); |
| 571 | } |
| 572 | |
| 573 | function log(uint256 p0, uint256 p1, bool p2, string memory p3) internal pure { |
| 574 | _sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,bool,string)", p0, p1, p2, p3)); |
| 575 | } |
| 576 | |
| 577 | function log(uint256 p0, uint256 p1, bool p2, bool p3) internal pure { |
| 578 | _sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,bool,bool)", p0, p1, p2, p3)); |
| 579 | } |
| 580 | |
| 581 | function log(uint256 p0, uint256 p1, bool p2, address p3) internal pure { |
| 582 | _sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,bool,address)", p0, p1, p2, p3)); |
| 583 | } |
| 584 | |
| 585 | function log(uint256 p0, uint256 p1, address p2, uint256 p3) internal pure { |
| 586 | _sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,address,uint256)", p0, p1, p2, p3)); |
| 587 | } |
| 588 | |
| 589 | function log(uint256 p0, uint256 p1, address p2, string memory p3) internal pure { |
| 590 | _sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,address,string)", p0, p1, p2, p3)); |
| 591 | } |
| 592 | |
| 593 | function log(uint256 p0, uint256 p1, address p2, bool p3) internal pure { |
| 594 | _sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,address,bool)", p0, p1, p2, p3)); |
| 595 | } |
| 596 | |
| 597 | function log(uint256 p0, uint256 p1, address p2, address p3) internal pure { |
| 598 | _sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,address,address)", p0, p1, p2, p3)); |
| 599 | } |
| 600 | |
| 601 | function log(uint256 p0, string memory p1, uint256 p2, uint256 p3) internal pure { |
| 602 | _sendLogPayload(abi.encodeWithSignature("log(uint256,string,uint256,uint256)", p0, p1, p2, p3)); |
| 603 | } |
| 604 | |
| 605 | function log(uint256 p0, string memory p1, uint256 p2, string memory p3) internal pure { |
| 606 | _sendLogPayload(abi.encodeWithSignature("log(uint256,string,uint256,string)", p0, p1, p2, p3)); |
| 607 | } |
| 608 | |
| 609 | function log(uint256 p0, string memory p1, uint256 p2, bool p3) internal pure { |
| 610 | _sendLogPayload(abi.encodeWithSignature("log(uint256,string,uint256,bool)", p0, p1, p2, p3)); |
| 611 | } |
| 612 | |
| 613 | function log(uint256 p0, string memory p1, uint256 p2, address p3) internal pure { |
| 614 | _sendLogPayload(abi.encodeWithSignature("log(uint256,string,uint256,address)", p0, p1, p2, p3)); |
| 615 | } |
| 616 | |
| 617 | function log(uint256 p0, string memory p1, string memory p2, uint256 p3) internal pure { |
| 618 | _sendLogPayload(abi.encodeWithSignature("log(uint256,string,string,uint256)", p0, p1, p2, p3)); |
| 619 | } |
| 620 | |
| 621 | function log(uint256 p0, string memory p1, string memory p2, string memory p3) internal pure { |
| 622 | _sendLogPayload(abi.encodeWithSignature("log(uint256,string,string,string)", p0, p1, p2, p3)); |
| 623 | } |
| 624 | |
| 625 | function log(uint256 p0, string memory p1, string memory p2, bool p3) internal pure { |
| 626 | _sendLogPayload(abi.encodeWithSignature("log(uint256,string,string,bool)", p0, p1, p2, p3)); |
| 627 | } |
| 628 | |
| 629 | function log(uint256 p0, string memory p1, string memory p2, address p3) internal pure { |
| 630 | _sendLogPayload(abi.encodeWithSignature("log(uint256,string,string,address)", p0, p1, p2, p3)); |
| 631 | } |
| 632 | |
| 633 | function log(uint256 p0, string memory p1, bool p2, uint256 p3) internal pure { |
| 634 | _sendLogPayload(abi.encodeWithSignature("log(uint256,string,bool,uint256)", p0, p1, p2, p3)); |
| 635 | } |
| 636 | |
| 637 | function log(uint256 p0, string memory p1, bool p2, string memory p3) internal pure { |
| 638 | _sendLogPayload(abi.encodeWithSignature("log(uint256,string,bool,string)", p0, p1, p2, p3)); |
| 639 | } |
| 640 | |
| 641 | function log(uint256 p0, string memory p1, bool p2, bool p3) internal pure { |
| 642 | _sendLogPayload(abi.encodeWithSignature("log(uint256,string,bool,bool)", p0, p1, p2, p3)); |
| 643 | } |
| 644 | |
| 645 | function log(uint256 p0, string memory p1, bool p2, address p3) internal pure { |
| 646 | _sendLogPayload(abi.encodeWithSignature("log(uint256,string,bool,address)", p0, p1, p2, p3)); |
| 647 | } |
| 648 | |
| 649 | function log(uint256 p0, string memory p1, address p2, uint256 p3) internal pure { |
| 650 | _sendLogPayload(abi.encodeWithSignature("log(uint256,string,address,uint256)", p0, p1, p2, p3)); |
| 651 | } |
| 652 | |
| 653 | function log(uint256 p0, string memory p1, address p2, string memory p3) internal pure { |
| 654 | _sendLogPayload(abi.encodeWithSignature("log(uint256,string,address,string)", p0, p1, p2, p3)); |
| 655 | } |
| 656 | |
| 657 | function log(uint256 p0, string memory p1, address p2, bool p3) internal pure { |
| 658 | _sendLogPayload(abi.encodeWithSignature("log(uint256,string,address,bool)", p0, p1, p2, p3)); |
| 659 | } |
| 660 | |
| 661 | function log(uint256 p0, string memory p1, address p2, address p3) internal pure { |
| 662 | _sendLogPayload(abi.encodeWithSignature("log(uint256,string,address,address)", p0, p1, p2, p3)); |
| 663 | } |
| 664 | |
| 665 | function log(uint256 p0, bool p1, uint256 p2, uint256 p3) internal pure { |
| 666 | _sendLogPayload(abi.encodeWithSignature("log(uint256,bool,uint256,uint256)", p0, p1, p2, p3)); |
| 667 | } |
| 668 | |
| 669 | function log(uint256 p0, bool p1, uint256 p2, string memory p3) internal pure { |
| 670 | _sendLogPayload(abi.encodeWithSignature("log(uint256,bool,uint256,string)", p0, p1, p2, p3)); |
| 671 | } |
| 672 | |
| 673 | function log(uint256 p0, bool p1, uint256 p2, bool p3) internal pure { |
| 674 | _sendLogPayload(abi.encodeWithSignature("log(uint256,bool,uint256,bool)", p0, p1, p2, p3)); |
| 675 | } |
| 676 | |
| 677 | function log(uint256 p0, bool p1, uint256 p2, address p3) internal pure { |
| 678 | _sendLogPayload(abi.encodeWithSignature("log(uint256,bool,uint256,address)", p0, p1, p2, p3)); |
| 679 | } |
| 680 | |
| 681 | function log(uint256 p0, bool p1, string memory p2, uint256 p3) internal pure { |
| 682 | _sendLogPayload(abi.encodeWithSignature("log(uint256,bool,string,uint256)", p0, p1, p2, p3)); |
| 683 | } |
| 684 | |
| 685 | function log(uint256 p0, bool p1, string memory p2, string memory p3) internal pure { |
| 686 | _sendLogPayload(abi.encodeWithSignature("log(uint256,bool,string,string)", p0, p1, p2, p3)); |
| 687 | } |
| 688 | |
| 689 | function log(uint256 p0, bool p1, string memory p2, bool p3) internal pure { |
| 690 | _sendLogPayload(abi.encodeWithSignature("log(uint256,bool,string,bool)", p0, p1, p2, p3)); |
| 691 | } |
| 692 | |
| 693 | function log(uint256 p0, bool p1, string memory p2, address p3) internal pure { |
| 694 | _sendLogPayload(abi.encodeWithSignature("log(uint256,bool,string,address)", p0, p1, p2, p3)); |
| 695 | } |
| 696 | |
| 697 | function log(uint256 p0, bool p1, bool p2, uint256 p3) internal pure { |
| 698 | _sendLogPayload(abi.encodeWithSignature("log(uint256,bool,bool,uint256)", p0, p1, p2, p3)); |
| 699 | } |
| 700 | |
| 701 | function log(uint256 p0, bool p1, bool p2, string memory p3) internal pure { |
| 702 | _sendLogPayload(abi.encodeWithSignature("log(uint256,bool,bool,string)", p0, p1, p2, p3)); |
| 703 | } |
| 704 | |
| 705 | function log(uint256 p0, bool p1, bool p2, bool p3) internal pure { |
| 706 | _sendLogPayload(abi.encodeWithSignature("log(uint256,bool,bool,bool)", p0, p1, p2, p3)); |
| 707 | } |
| 708 | |
| 709 | function log(uint256 p0, bool p1, bool p2, address p3) internal pure { |
| 710 | _sendLogPayload(abi.encodeWithSignature("log(uint256,bool,bool,address)", p0, p1, p2, p3)); |
| 711 | } |
| 712 | |
| 713 | function log(uint256 p0, bool p1, address p2, uint256 p3) internal pure { |
| 714 | _sendLogPayload(abi.encodeWithSignature("log(uint256,bool,address,uint256)", p0, p1, p2, p3)); |
| 715 | } |
| 716 | |
| 717 | function log(uint256 p0, bool p1, address p2, string memory p3) internal pure { |
| 718 | _sendLogPayload(abi.encodeWithSignature("log(uint256,bool,address,string)", p0, p1, p2, p3)); |
| 719 | } |
| 720 | |
| 721 | function log(uint256 p0, bool p1, address p2, bool p3) internal pure { |
| 722 | _sendLogPayload(abi.encodeWithSignature("log(uint256,bool,address,bool)", p0, p1, p2, p3)); |
| 723 | } |
| 724 | |
| 725 | function log(uint256 p0, bool p1, address p2, address p3) internal pure { |
| 726 | _sendLogPayload(abi.encodeWithSignature("log(uint256,bool,address,address)", p0, p1, p2, p3)); |
| 727 | } |
| 728 | |
| 729 | function log(uint256 p0, address p1, uint256 p2, uint256 p3) internal pure { |
| 730 | _sendLogPayload(abi.encodeWithSignature("log(uint256,address,uint256,uint256)", p0, p1, p2, p3)); |
| 731 | } |
| 732 | |
| 733 | function log(uint256 p0, address p1, uint256 p2, string memory p3) internal pure { |
| 734 | _sendLogPayload(abi.encodeWithSignature("log(uint256,address,uint256,string)", p0, p1, p2, p3)); |
| 735 | } |
| 736 | |
| 737 | function log(uint256 p0, address p1, uint256 p2, bool p3) internal pure { |
| 738 | _sendLogPayload(abi.encodeWithSignature("log(uint256,address,uint256,bool)", p0, p1, p2, p3)); |
| 739 | } |
| 740 | |
| 741 | function log(uint256 p0, address p1, uint256 p2, address p3) internal pure { |
| 742 | _sendLogPayload(abi.encodeWithSignature("log(uint256,address,uint256,address)", p0, p1, p2, p3)); |
| 743 | } |
| 744 | |
| 745 | function log(uint256 p0, address p1, string memory p2, uint256 p3) internal pure { |
| 746 | _sendLogPayload(abi.encodeWithSignature("log(uint256,address,string,uint256)", p0, p1, p2, p3)); |
| 747 | } |
| 748 | |
| 749 | function log(uint256 p0, address p1, string memory p2, string memory p3) internal pure { |
| 750 | _sendLogPayload(abi.encodeWithSignature("log(uint256,address,string,string)", p0, p1, p2, p3)); |
| 751 | } |
| 752 | |
| 753 | function log(uint256 p0, address p1, string memory p2, bool p3) internal pure { |
| 754 | _sendLogPayload(abi.encodeWithSignature("log(uint256,address,string,bool)", p0, p1, p2, p3)); |
| 755 | } |
| 756 | |
| 757 | function log(uint256 p0, address p1, string memory p2, address p3) internal pure { |
| 758 | _sendLogPayload(abi.encodeWithSignature("log(uint256,address,string,address)", p0, p1, p2, p3)); |
| 759 | } |
| 760 | |
| 761 | function log(uint256 p0, address p1, bool p2, uint256 p3) internal pure { |
| 762 | _sendLogPayload(abi.encodeWithSignature("log(uint256,address,bool,uint256)", p0, p1, p2, p3)); |
| 763 | } |
| 764 | |
| 765 | function log(uint256 p0, address p1, bool p2, string memory p3) internal pure { |
| 766 | _sendLogPayload(abi.encodeWithSignature("log(uint256,address,bool,string)", p0, p1, p2, p3)); |
| 767 | } |
| 768 | |
| 769 | function log(uint256 p0, address p1, bool p2, bool p3) internal pure { |
| 770 | _sendLogPayload(abi.encodeWithSignature("log(uint256,address,bool,bool)", p0, p1, p2, p3)); |
| 771 | } |
| 772 | |
| 773 | function log(uint256 p0, address p1, bool p2, address p3) internal pure { |
| 774 | _sendLogPayload(abi.encodeWithSignature("log(uint256,address,bool,address)", p0, p1, p2, p3)); |
| 775 | } |
| 776 | |
| 777 | function log(uint256 p0, address p1, address p2, uint256 p3) internal pure { |
| 778 | _sendLogPayload(abi.encodeWithSignature("log(uint256,address,address,uint256)", p0, p1, p2, p3)); |
| 779 | } |
| 780 | |
| 781 | function log(uint256 p0, address p1, address p2, string memory p3) internal pure { |
| 782 | _sendLogPayload(abi.encodeWithSignature("log(uint256,address,address,string)", p0, p1, p2, p3)); |
| 783 | } |
| 784 | |
| 785 | function log(uint256 p0, address p1, address p2, bool p3) internal pure { |
| 786 | _sendLogPayload(abi.encodeWithSignature("log(uint256,address,address,bool)", p0, p1, p2, p3)); |
| 787 | } |
| 788 | |
| 789 | function log(uint256 p0, address p1, address p2, address p3) internal pure { |
| 790 | _sendLogPayload(abi.encodeWithSignature("log(uint256,address,address,address)", p0, p1, p2, p3)); |
| 791 | } |
| 792 | |
| 793 | function log(string memory p0, uint256 p1, uint256 p2, uint256 p3) internal pure { |
| 794 | _sendLogPayload(abi.encodeWithSignature("log(string,uint256,uint256,uint256)", p0, p1, p2, p3)); |
| 795 | } |
| 796 | |
| 797 | function log(string memory p0, uint256 p1, uint256 p2, string memory p3) internal pure { |
| 798 | _sendLogPayload(abi.encodeWithSignature("log(string,uint256,uint256,string)", p0, p1, p2, p3)); |
| 799 | } |
| 800 | |
| 801 | function log(string memory p0, uint256 p1, uint256 p2, bool p3) internal pure { |
| 802 | _sendLogPayload(abi.encodeWithSignature("log(string,uint256,uint256,bool)", p0, p1, p2, p3)); |
| 803 | } |
| 804 | |
| 805 | function log(string memory p0, uint256 p1, uint256 p2, address p3) internal pure { |
| 806 | _sendLogPayload(abi.encodeWithSignature("log(string,uint256,uint256,address)", p0, p1, p2, p3)); |
| 807 | } |
| 808 | |
| 809 | function log(string memory p0, uint256 p1, string memory p2, uint256 p3) internal pure { |
| 810 | _sendLogPayload(abi.encodeWithSignature("log(string,uint256,string,uint256)", p0, p1, p2, p3)); |
| 811 | } |
| 812 | |
| 813 | function log(string memory p0, uint256 p1, string memory p2, string memory p3) internal pure { |
| 814 | _sendLogPayload(abi.encodeWithSignature("log(string,uint256,string,string)", p0, p1, p2, p3)); |
| 815 | } |
| 816 | |
| 817 | function log(string memory p0, uint256 p1, string memory p2, bool p3) internal pure { |
| 818 | _sendLogPayload(abi.encodeWithSignature("log(string,uint256,string,bool)", p0, p1, p2, p3)); |
| 819 | } |
| 820 | |
| 821 | function log(string memory p0, uint256 p1, string memory p2, address p3) internal pure { |
| 822 | _sendLogPayload(abi.encodeWithSignature("log(string,uint256,string,address)", p0, p1, p2, p3)); |
| 823 | } |
| 824 | |
| 825 | function log(string memory p0, uint256 p1, bool p2, uint256 p3) internal pure { |
| 826 | _sendLogPayload(abi.encodeWithSignature("log(string,uint256,bool,uint256)", p0, p1, p2, p3)); |
| 827 | } |
| 828 | |
| 829 | function log(string memory p0, uint256 p1, bool p2, string memory p3) internal pure { |
| 830 | _sendLogPayload(abi.encodeWithSignature("log(string,uint256,bool,string)", p0, p1, p2, p3)); |
| 831 | } |
| 832 | |
| 833 | function log(string memory p0, uint256 p1, bool p2, bool p3) internal pure { |
| 834 | _sendLogPayload(abi.encodeWithSignature("log(string,uint256,bool,bool)", p0, p1, p2, p3)); |
| 835 | } |
| 836 | |
| 837 | function log(string memory p0, uint256 p1, bool p2, address p3) internal pure { |
| 838 | _sendLogPayload(abi.encodeWithSignature("log(string,uint256,bool,address)", p0, p1, p2, p3)); |
| 839 | } |
| 840 | |
| 841 | function log(string memory p0, uint256 p1, address p2, uint256 p3) internal pure { |
| 842 | _sendLogPayload(abi.encodeWithSignature("log(string,uint256,address,uint256)", p0, p1, p2, p3)); |
| 843 | } |
| 844 | |
| 845 | function log(string memory p0, uint256 p1, address p2, string memory p3) internal pure { |
| 846 | _sendLogPayload(abi.encodeWithSignature("log(string,uint256,address,string)", p0, p1, p2, p3)); |
| 847 | } |
| 848 | |
| 849 | function log(string memory p0, uint256 p1, address p2, bool p3) internal pure { |
| 850 | _sendLogPayload(abi.encodeWithSignature("log(string,uint256,address,bool)", p0, p1, p2, p3)); |
| 851 | } |
| 852 | |
| 853 | function log(string memory p0, uint256 p1, address p2, address p3) internal pure { |
| 854 | _sendLogPayload(abi.encodeWithSignature("log(string,uint256,address,address)", p0, p1, p2, p3)); |
| 855 | } |
| 856 | |
| 857 | function log(string memory p0, string memory p1, uint256 p2, uint256 p3) internal pure { |
| 858 | _sendLogPayload(abi.encodeWithSignature("log(string,string,uint256,uint256)", p0, p1, p2, p3)); |
| 859 | } |
| 860 | |
| 861 | function log(string memory p0, string memory p1, uint256 p2, string memory p3) internal pure { |
| 862 | _sendLogPayload(abi.encodeWithSignature("log(string,string,uint256,string)", p0, p1, p2, p3)); |
| 863 | } |
| 864 | |
| 865 | function log(string memory p0, string memory p1, uint256 p2, bool p3) internal pure { |
| 866 | _sendLogPayload(abi.encodeWithSignature("log(string,string,uint256,bool)", p0, p1, p2, p3)); |
| 867 | } |
| 868 | |
| 869 | function log(string memory p0, string memory p1, uint256 p2, address p3) internal pure { |
| 870 | _sendLogPayload(abi.encodeWithSignature("log(string,string,uint256,address)", p0, p1, p2, p3)); |
| 871 | } |
| 872 | |
| 873 | function log(string memory p0, string memory p1, string memory p2, uint256 p3) internal pure { |
| 874 | _sendLogPayload(abi.encodeWithSignature("log(string,string,string,uint256)", p0, p1, p2, p3)); |
| 875 | } |
| 876 | |
| 877 | function log(string memory p0, string memory p1, string memory p2, string memory p3) internal pure { |
| 878 | _sendLogPayload(abi.encodeWithSignature("log(string,string,string,string)", p0, p1, p2, p3)); |
| 879 | } |
| 880 | |
| 881 | function log(string memory p0, string memory p1, string memory p2, bool p3) internal pure { |
| 882 | _sendLogPayload(abi.encodeWithSignature("log(string,string,string,bool)", p0, p1, p2, p3)); |
| 883 | } |
| 884 | |
| 885 | function log(string memory p0, string memory p1, string memory p2, address p3) internal pure { |
| 886 | _sendLogPayload(abi.encodeWithSignature("log(string,string,string,address)", p0, p1, p2, p3)); |
| 887 | } |
| 888 | |
| 889 | function log(string memory p0, string memory p1, bool p2, uint256 p3) internal pure { |
| 890 | _sendLogPayload(abi.encodeWithSignature("log(string,string,bool,uint256)", p0, p1, p2, p3)); |
| 891 | } |
| 892 | |
| 893 | function log(string memory p0, string memory p1, bool p2, string memory p3) internal pure { |
| 894 | _sendLogPayload(abi.encodeWithSignature("log(string,string,bool,string)", p0, p1, p2, p3)); |
| 895 | } |
| 896 | |
| 897 | function log(string memory p0, string memory p1, bool p2, bool p3) internal pure { |
| 898 | _sendLogPayload(abi.encodeWithSignature("log(string,string,bool,bool)", p0, p1, p2, p3)); |
| 899 | } |
| 900 | |
| 901 | function log(string memory p0, string memory p1, bool p2, address p3) internal pure { |
| 902 | _sendLogPayload(abi.encodeWithSignature("log(string,string,bool,address)", p0, p1, p2, p3)); |
| 903 | } |
| 904 | |
| 905 | function log(string memory p0, string memory p1, address p2, uint256 p3) internal pure { |
| 906 | _sendLogPayload(abi.encodeWithSignature("log(string,string,address,uint256)", p0, p1, p2, p3)); |
| 907 | } |
| 908 | |
| 909 | function log(string memory p0, string memory p1, address p2, string memory p3) internal pure { |
| 910 | _sendLogPayload(abi.encodeWithSignature("log(string,string,address,string)", p0, p1, p2, p3)); |
| 911 | } |
| 912 | |
| 913 | function log(string memory p0, string memory p1, address p2, bool p3) internal pure { |
| 914 | _sendLogPayload(abi.encodeWithSignature("log(string,string,address,bool)", p0, p1, p2, p3)); |
| 915 | } |
| 916 | |
| 917 | function log(string memory p0, string memory p1, address p2, address p3) internal pure { |
| 918 | _sendLogPayload(abi.encodeWithSignature("log(string,string,address,address)", p0, p1, p2, p3)); |
| 919 | } |
| 920 | |
| 921 | function log(string memory p0, bool p1, uint256 p2, uint256 p3) internal pure { |
| 922 | _sendLogPayload(abi.encodeWithSignature("log(string,bool,uint256,uint256)", p0, p1, p2, p3)); |
| 923 | } |
| 924 | |
| 925 | function log(string memory p0, bool p1, uint256 p2, string memory p3) internal pure { |
| 926 | _sendLogPayload(abi.encodeWithSignature("log(string,bool,uint256,string)", p0, p1, p2, p3)); |
| 927 | } |
| 928 | |
| 929 | function log(string memory p0, bool p1, uint256 p2, bool p3) internal pure { |
| 930 | _sendLogPayload(abi.encodeWithSignature("log(string,bool,uint256,bool)", p0, p1, p2, p3)); |
| 931 | } |
| 932 | |
| 933 | function log(string memory p0, bool p1, uint256 p2, address p3) internal pure { |
| 934 | _sendLogPayload(abi.encodeWithSignature("log(string,bool,uint256,address)", p0, p1, p2, p3)); |
| 935 | } |
| 936 | |
| 937 | function log(string memory p0, bool p1, string memory p2, uint256 p3) internal pure { |
| 938 | _sendLogPayload(abi.encodeWithSignature("log(string,bool,string,uint256)", p0, p1, p2, p3)); |
| 939 | } |
| 940 | |
| 941 | function log(string memory p0, bool p1, string memory p2, string memory p3) internal pure { |
| 942 | _sendLogPayload(abi.encodeWithSignature("log(string,bool,string,string)", p0, p1, p2, p3)); |
| 943 | } |
| 944 | |
| 945 | function log(string memory p0, bool p1, string memory p2, bool p3) internal pure { |
| 946 | _sendLogPayload(abi.encodeWithSignature("log(string,bool,string,bool)", p0, p1, p2, p3)); |
| 947 | } |
| 948 | |
| 949 | function log(string memory p0, bool p1, string memory p2, address p3) internal pure { |
| 950 | _sendLogPayload(abi.encodeWithSignature("log(string,bool,string,address)", p0, p1, p2, p3)); |
| 951 | } |
| 952 | |
| 953 | function log(string memory p0, bool p1, bool p2, uint256 p3) internal pure { |
| 954 | _sendLogPayload(abi.encodeWithSignature("log(string,bool,bool,uint256)", p0, p1, p2, p3)); |
| 955 | } |
| 956 | |
| 957 | function log(string memory p0, bool p1, bool p2, string memory p3) internal pure { |
| 958 | _sendLogPayload(abi.encodeWithSignature("log(string,bool,bool,string)", p0, p1, p2, p3)); |
| 959 | } |
| 960 | |
| 961 | function log(string memory p0, bool p1, bool p2, bool p3) internal pure { |
| 962 | _sendLogPayload(abi.encodeWithSignature("log(string,bool,bool,bool)", p0, p1, p2, p3)); |
| 963 | } |
| 964 | |
| 965 | function log(string memory p0, bool p1, bool p2, address p3) internal pure { |
| 966 | _sendLogPayload(abi.encodeWithSignature("log(string,bool,bool,address)", p0, p1, p2, p3)); |
| 967 | } |
| 968 | |
| 969 | function log(string memory p0, bool p1, address p2, uint256 p3) internal pure { |
| 970 | _sendLogPayload(abi.encodeWithSignature("log(string,bool,address,uint256)", p0, p1, p2, p3)); |
| 971 | } |
| 972 | |
| 973 | function log(string memory p0, bool p1, address p2, string memory p3) internal pure { |
| 974 | _sendLogPayload(abi.encodeWithSignature("log(string,bool,address,string)", p0, p1, p2, p3)); |
| 975 | } |
| 976 | |
| 977 | function log(string memory p0, bool p1, address p2, bool p3) internal pure { |
| 978 | _sendLogPayload(abi.encodeWithSignature("log(string,bool,address,bool)", p0, p1, p2, p3)); |
| 979 | } |
| 980 | |
| 981 | function log(string memory p0, bool p1, address p2, address p3) internal pure { |
| 982 | _sendLogPayload(abi.encodeWithSignature("log(string,bool,address,address)", p0, p1, p2, p3)); |
| 983 | } |
| 984 | |
| 985 | function log(string memory p0, address p1, uint256 p2, uint256 p3) internal pure { |
| 986 | _sendLogPayload(abi.encodeWithSignature("log(string,address,uint256,uint256)", p0, p1, p2, p3)); |
| 987 | } |
| 988 | |
| 989 | function log(string memory p0, address p1, uint256 p2, string memory p3) internal pure { |
| 990 | _sendLogPayload(abi.encodeWithSignature("log(string,address,uint256,string)", p0, p1, p2, p3)); |
| 991 | } |
| 992 | |
| 993 | function log(string memory p0, address p1, uint256 p2, bool p3) internal pure { |
| 994 | _sendLogPayload(abi.encodeWithSignature("log(string,address,uint256,bool)", p0, p1, p2, p3)); |
| 995 | } |
| 996 | |
| 997 | function log(string memory p0, address p1, uint256 p2, address p3) internal pure { |
| 998 | _sendLogPayload(abi.encodeWithSignature("log(string,address,uint256,address)", p0, p1, p2, p3)); |
| 999 | } |
| 1000 | |
| 1001 | function log(string memory p0, address p1, string memory p2, uint256 p3) internal pure { |
| 1002 | _sendLogPayload(abi.encodeWithSignature("log(string,address,string,uint256)", p0, p1, p2, p3)); |
| 1003 | } |
| 1004 | |
| 1005 | function log(string memory p0, address p1, string memory p2, string memory p3) internal pure { |
| 1006 | _sendLogPayload(abi.encodeWithSignature("log(string,address,string,string)", p0, p1, p2, p3)); |
| 1007 | } |
| 1008 | |
| 1009 | function log(string memory p0, address p1, string memory p2, bool p3) internal pure { |
| 1010 | _sendLogPayload(abi.encodeWithSignature("log(string,address,string,bool)", p0, p1, p2, p3)); |
| 1011 | } |
| 1012 | |
| 1013 | function log(string memory p0, address p1, string memory p2, address p3) internal pure { |
| 1014 | _sendLogPayload(abi.encodeWithSignature("log(string,address,string,address)", p0, p1, p2, p3)); |
| 1015 | } |
| 1016 | |
| 1017 | function log(string memory p0, address p1, bool p2, uint256 p3) internal pure { |
| 1018 | _sendLogPayload(abi.encodeWithSignature("log(string,address,bool,uint256)", p0, p1, p2, p3)); |
| 1019 | } |
| 1020 | |
| 1021 | function log(string memory p0, address p1, bool p2, string memory p3) internal pure { |
| 1022 | _sendLogPayload(abi.encodeWithSignature("log(string,address,bool,string)", p0, p1, p2, p3)); |
| 1023 | } |
| 1024 | |
| 1025 | function log(string memory p0, address p1, bool p2, bool p3) internal pure { |
| 1026 | _sendLogPayload(abi.encodeWithSignature("log(string,address,bool,bool)", p0, p1, p2, p3)); |
| 1027 | } |
| 1028 | |
| 1029 | function log(string memory p0, address p1, bool p2, address p3) internal pure { |
| 1030 | _sendLogPayload(abi.encodeWithSignature("log(string,address,bool,address)", p0, p1, p2, p3)); |
| 1031 | } |
| 1032 | |
| 1033 | function log(string memory p0, address p1, address p2, uint256 p3) internal pure { |
| 1034 | _sendLogPayload(abi.encodeWithSignature("log(string,address,address,uint256)", p0, p1, p2, p3)); |
| 1035 | } |
| 1036 | |
| 1037 | function log(string memory p0, address p1, address p2, string memory p3) internal pure { |
| 1038 | _sendLogPayload(abi.encodeWithSignature("log(string,address,address,string)", p0, p1, p2, p3)); |
| 1039 | } |
| 1040 | |
| 1041 | function log(string memory p0, address p1, address p2, bool p3) internal pure { |
| 1042 | _sendLogPayload(abi.encodeWithSignature("log(string,address,address,bool)", p0, p1, p2, p3)); |
| 1043 | } |
| 1044 | |
| 1045 | function log(string memory p0, address p1, address p2, address p3) internal pure { |
| 1046 | _sendLogPayload(abi.encodeWithSignature("log(string,address,address,address)", p0, p1, p2, p3)); |
| 1047 | } |
| 1048 | |
| 1049 | function log(bool p0, uint256 p1, uint256 p2, uint256 p3) internal pure { |
| 1050 | _sendLogPayload(abi.encodeWithSignature("log(bool,uint256,uint256,uint256)", p0, p1, p2, p3)); |
| 1051 | } |
| 1052 | |
| 1053 | function log(bool p0, uint256 p1, uint256 p2, string memory p3) internal pure { |
| 1054 | _sendLogPayload(abi.encodeWithSignature("log(bool,uint256,uint256,string)", p0, p1, p2, p3)); |
| 1055 | } |
| 1056 | |
| 1057 | function log(bool p0, uint256 p1, uint256 p2, bool p3) internal pure { |
| 1058 | _sendLogPayload(abi.encodeWithSignature("log(bool,uint256,uint256,bool)", p0, p1, p2, p3)); |
| 1059 | } |
| 1060 | |
| 1061 | function log(bool p0, uint256 p1, uint256 p2, address p3) internal pure { |
| 1062 | _sendLogPayload(abi.encodeWithSignature("log(bool,uint256,uint256,address)", p0, p1, p2, p3)); |
| 1063 | } |
| 1064 | |
| 1065 | function log(bool p0, uint256 p1, string memory p2, uint256 p3) internal pure { |
| 1066 | _sendLogPayload(abi.encodeWithSignature("log(bool,uint256,string,uint256)", p0, p1, p2, p3)); |
| 1067 | } |
| 1068 | |
| 1069 | function log(bool p0, uint256 p1, string memory p2, string memory p3) internal pure { |
| 1070 | _sendLogPayload(abi.encodeWithSignature("log(bool,uint256,string,string)", p0, p1, p2, p3)); |
| 1071 | } |
| 1072 | |
| 1073 | function log(bool p0, uint256 p1, string memory p2, bool p3) internal pure { |
| 1074 | _sendLogPayload(abi.encodeWithSignature("log(bool,uint256,string,bool)", p0, p1, p2, p3)); |
| 1075 | } |
| 1076 | |
| 1077 | function log(bool p0, uint256 p1, string memory p2, address p3) internal pure { |
| 1078 | _sendLogPayload(abi.encodeWithSignature("log(bool,uint256,string,address)", p0, p1, p2, p3)); |
| 1079 | } |
| 1080 | |
| 1081 | function log(bool p0, uint256 p1, bool p2, uint256 p3) internal pure { |
| 1082 | _sendLogPayload(abi.encodeWithSignature("log(bool,uint256,bool,uint256)", p0, p1, p2, p3)); |
| 1083 | } |
| 1084 | |
| 1085 | function log(bool p0, uint256 p1, bool p2, string memory p3) internal pure { |
| 1086 | _sendLogPayload(abi.encodeWithSignature("log(bool,uint256,bool,string)", p0, p1, p2, p3)); |
| 1087 | } |
| 1088 | |
| 1089 | function log(bool p0, uint256 p1, bool p2, bool p3) internal pure { |
| 1090 | _sendLogPayload(abi.encodeWithSignature("log(bool,uint256,bool,bool)", p0, p1, p2, p3)); |
| 1091 | } |
| 1092 | |
| 1093 | function log(bool p0, uint256 p1, bool p2, address p3) internal pure { |
| 1094 | _sendLogPayload(abi.encodeWithSignature("log(bool,uint256,bool,address)", p0, p1, p2, p3)); |
| 1095 | } |
| 1096 | |
| 1097 | function log(bool p0, uint256 p1, address p2, uint256 p3) internal pure { |
| 1098 | _sendLogPayload(abi.encodeWithSignature("log(bool,uint256,address,uint256)", p0, p1, p2, p3)); |
| 1099 | } |
| 1100 | |
| 1101 | function log(bool p0, uint256 p1, address p2, string memory p3) internal pure { |
| 1102 | _sendLogPayload(abi.encodeWithSignature("log(bool,uint256,address,string)", p0, p1, p2, p3)); |
| 1103 | } |
| 1104 | |
| 1105 | function log(bool p0, uint256 p1, address p2, bool p3) internal pure { |
| 1106 | _sendLogPayload(abi.encodeWithSignature("log(bool,uint256,address,bool)", p0, p1, p2, p3)); |
| 1107 | } |
| 1108 | |
| 1109 | function log(bool p0, uint256 p1, address p2, address p3) internal pure { |
| 1110 | _sendLogPayload(abi.encodeWithSignature("log(bool,uint256,address,address)", p0, p1, p2, p3)); |
| 1111 | } |
| 1112 | |
| 1113 | function log(bool p0, string memory p1, uint256 p2, uint256 p3) internal pure { |
| 1114 | _sendLogPayload(abi.encodeWithSignature("log(bool,string,uint256,uint256)", p0, p1, p2, p3)); |
| 1115 | } |
| 1116 | |
| 1117 | function log(bool p0, string memory p1, uint256 p2, string memory p3) internal pure { |
| 1118 | _sendLogPayload(abi.encodeWithSignature("log(bool,string,uint256,string)", p0, p1, p2, p3)); |
| 1119 | } |
| 1120 | |
| 1121 | function log(bool p0, string memory p1, uint256 p2, bool p3) internal pure { |
| 1122 | _sendLogPayload(abi.encodeWithSignature("log(bool,string,uint256,bool)", p0, p1, p2, p3)); |
| 1123 | } |
| 1124 | |
| 1125 | function log(bool p0, string memory p1, uint256 p2, address p3) internal pure { |
| 1126 | _sendLogPayload(abi.encodeWithSignature("log(bool,string,uint256,address)", p0, p1, p2, p3)); |
| 1127 | } |
| 1128 | |
| 1129 | function log(bool p0, string memory p1, string memory p2, uint256 p3) internal pure { |
| 1130 | _sendLogPayload(abi.encodeWithSignature("log(bool,string,string,uint256)", p0, p1, p2, p3)); |
| 1131 | } |
| 1132 | |
| 1133 | function log(bool p0, string memory p1, string memory p2, string memory p3) internal pure { |
| 1134 | _sendLogPayload(abi.encodeWithSignature("log(bool,string,string,string)", p0, p1, p2, p3)); |
| 1135 | } |
| 1136 | |
| 1137 | function log(bool p0, string memory p1, string memory p2, bool p3) internal pure { |
| 1138 | _sendLogPayload(abi.encodeWithSignature("log(bool,string,string,bool)", p0, p1, p2, p3)); |
| 1139 | } |
| 1140 | |
| 1141 | function log(bool p0, string memory p1, string memory p2, address p3) internal pure { |
| 1142 | _sendLogPayload(abi.encodeWithSignature("log(bool,string,string,address)", p0, p1, p2, p3)); |
| 1143 | } |
| 1144 | |
| 1145 | function log(bool p0, string memory p1, bool p2, uint256 p3) internal pure { |
| 1146 | _sendLogPayload(abi.encodeWithSignature("log(bool,string,bool,uint256)", p0, p1, p2, p3)); |
| 1147 | } |
| 1148 | |
| 1149 | function log(bool p0, string memory p1, bool p2, string memory p3) internal pure { |
| 1150 | _sendLogPayload(abi.encodeWithSignature("log(bool,string,bool,string)", p0, p1, p2, p3)); |
| 1151 | } |
| 1152 | |
| 1153 | function log(bool p0, string memory p1, bool p2, bool p3) internal pure { |
| 1154 | _sendLogPayload(abi.encodeWithSignature("log(bool,string,bool,bool)", p0, p1, p2, p3)); |
| 1155 | } |
| 1156 | |
| 1157 | function log(bool p0, string memory p1, bool p2, address p3) internal pure { |
| 1158 | _sendLogPayload(abi.encodeWithSignature("log(bool,string,bool,address)", p0, p1, p2, p3)); |
| 1159 | } |
| 1160 | |
| 1161 | function log(bool p0, string memory p1, address p2, uint256 p3) internal pure { |
| 1162 | _sendLogPayload(abi.encodeWithSignature("log(bool,string,address,uint256)", p0, p1, p2, p3)); |
| 1163 | } |
| 1164 | |
| 1165 | function log(bool p0, string memory p1, address p2, string memory p3) internal pure { |
| 1166 | _sendLogPayload(abi.encodeWithSignature("log(bool,string,address,string)", p0, p1, p2, p3)); |
| 1167 | } |
| 1168 | |
| 1169 | function log(bool p0, string memory p1, address p2, bool p3) internal pure { |
| 1170 | _sendLogPayload(abi.encodeWithSignature("log(bool,string,address,bool)", p0, p1, p2, p3)); |
| 1171 | } |
| 1172 | |
| 1173 | function log(bool p0, string memory p1, address p2, address p3) internal pure { |
| 1174 | _sendLogPayload(abi.encodeWithSignature("log(bool,string,address,address)", p0, p1, p2, p3)); |
| 1175 | } |
| 1176 | |
| 1177 | function log(bool p0, bool p1, uint256 p2, uint256 p3) internal pure { |
| 1178 | _sendLogPayload(abi.encodeWithSignature("log(bool,bool,uint256,uint256)", p0, p1, p2, p3)); |
| 1179 | } |
| 1180 | |
| 1181 | function log(bool p0, bool p1, uint256 p2, string memory p3) internal pure { |
| 1182 | _sendLogPayload(abi.encodeWithSignature("log(bool,bool,uint256,string)", p0, p1, p2, p3)); |
| 1183 | } |
| 1184 | |
| 1185 | function log(bool p0, bool p1, uint256 p2, bool p3) internal pure { |
| 1186 | _sendLogPayload(abi.encodeWithSignature("log(bool,bool,uint256,bool)", p0, p1, p2, p3)); |
| 1187 | } |
| 1188 | |
| 1189 | function log(bool p0, bool p1, uint256 p2, address p3) internal pure { |
| 1190 | _sendLogPayload(abi.encodeWithSignature("log(bool,bool,uint256,address)", p0, p1, p2, p3)); |
| 1191 | } |
| 1192 | |
| 1193 | function log(bool p0, bool p1, string memory p2, uint256 p3) internal pure { |
| 1194 | _sendLogPayload(abi.encodeWithSignature("log(bool,bool,string,uint256)", p0, p1, p2, p3)); |
| 1195 | } |
| 1196 | |
| 1197 | function log(bool p0, bool p1, string memory p2, string memory p3) internal pure { |
| 1198 | _sendLogPayload(abi.encodeWithSignature("log(bool,bool,string,string)", p0, p1, p2, p3)); |
| 1199 | } |
| 1200 | |
| 1201 | function log(bool p0, bool p1, string memory p2, bool p3) internal pure { |
| 1202 | _sendLogPayload(abi.encodeWithSignature("log(bool,bool,string,bool)", p0, p1, p2, p3)); |
| 1203 | } |
| 1204 | |
| 1205 | function log(bool p0, bool p1, string memory p2, address p3) internal pure { |
| 1206 | _sendLogPayload(abi.encodeWithSignature("log(bool,bool,string,address)", p0, p1, p2, p3)); |
| 1207 | } |
| 1208 | |
| 1209 | function log(bool p0, bool p1, bool p2, uint256 p3) internal pure { |
| 1210 | _sendLogPayload(abi.encodeWithSignature("log(bool,bool,bool,uint256)", p0, p1, p2, p3)); |
| 1211 | } |
| 1212 | |
| 1213 | function log(bool p0, bool p1, bool p2, string memory p3) internal pure { |
| 1214 | _sendLogPayload(abi.encodeWithSignature("log(bool,bool,bool,string)", p0, p1, p2, p3)); |
| 1215 | } |
| 1216 | |
| 1217 | function log(bool p0, bool p1, bool p2, bool p3) internal pure { |
| 1218 | _sendLogPayload(abi.encodeWithSignature("log(bool,bool,bool,bool)", p0, p1, p2, p3)); |
| 1219 | } |
| 1220 | |
| 1221 | function log(bool p0, bool p1, bool p2, address p3) internal pure { |
| 1222 | _sendLogPayload(abi.encodeWithSignature("log(bool,bool,bool,address)", p0, p1, p2, p3)); |
| 1223 | } |
| 1224 | |
| 1225 | function log(bool p0, bool p1, address p2, uint256 p3) internal pure { |
| 1226 | _sendLogPayload(abi.encodeWithSignature("log(bool,bool,address,uint256)", p0, p1, p2, p3)); |
| 1227 | } |
| 1228 | |
| 1229 | function log(bool p0, bool p1, address p2, string memory p3) internal pure { |
| 1230 | _sendLogPayload(abi.encodeWithSignature("log(bool,bool,address,string)", p0, p1, p2, p3)); |
| 1231 | } |
| 1232 | |
| 1233 | function log(bool p0, bool p1, address p2, bool p3) internal pure { |
| 1234 | _sendLogPayload(abi.encodeWithSignature("log(bool,bool,address,bool)", p0, p1, p2, p3)); |
| 1235 | } |
| 1236 | |
| 1237 | function log(bool p0, bool p1, address p2, address p3) internal pure { |
| 1238 | _sendLogPayload(abi.encodeWithSignature("log(bool,bool,address,address)", p0, p1, p2, p3)); |
| 1239 | } |
| 1240 | |
| 1241 | function log(bool p0, address p1, uint256 p2, uint256 p3) internal pure { |
| 1242 | _sendLogPayload(abi.encodeWithSignature("log(bool,address,uint256,uint256)", p0, p1, p2, p3)); |
| 1243 | } |
| 1244 | |
| 1245 | function log(bool p0, address p1, uint256 p2, string memory p3) internal pure { |
| 1246 | _sendLogPayload(abi.encodeWithSignature("log(bool,address,uint256,string)", p0, p1, p2, p3)); |
| 1247 | } |
| 1248 | |
| 1249 | function log(bool p0, address p1, uint256 p2, bool p3) internal pure { |
| 1250 | _sendLogPayload(abi.encodeWithSignature("log(bool,address,uint256,bool)", p0, p1, p2, p3)); |
| 1251 | } |
| 1252 | |
| 1253 | function log(bool p0, address p1, uint256 p2, address p3) internal pure { |
| 1254 | _sendLogPayload(abi.encodeWithSignature("log(bool,address,uint256,address)", p0, p1, p2, p3)); |
| 1255 | } |
| 1256 | |
| 1257 | function log(bool p0, address p1, string memory p2, uint256 p3) internal pure { |
| 1258 | _sendLogPayload(abi.encodeWithSignature("log(bool,address,string,uint256)", p0, p1, p2, p3)); |
| 1259 | } |
| 1260 | |
| 1261 | function log(bool p0, address p1, string memory p2, string memory p3) internal pure { |
| 1262 | _sendLogPayload(abi.encodeWithSignature("log(bool,address,string,string)", p0, p1, p2, p3)); |
| 1263 | } |
| 1264 | |
| 1265 | function log(bool p0, address p1, string memory p2, bool p3) internal pure { |
| 1266 | _sendLogPayload(abi.encodeWithSignature("log(bool,address,string,bool)", p0, p1, p2, p3)); |
| 1267 | } |
| 1268 | |
| 1269 | function log(bool p0, address p1, string memory p2, address p3) internal pure { |
| 1270 | _sendLogPayload(abi.encodeWithSignature("log(bool,address,string,address)", p0, p1, p2, p3)); |
| 1271 | } |
| 1272 | |
| 1273 | function log(bool p0, address p1, bool p2, uint256 p3) internal pure { |
| 1274 | _sendLogPayload(abi.encodeWithSignature("log(bool,address,bool,uint256)", p0, p1, p2, p3)); |
| 1275 | } |
| 1276 | |
| 1277 | function log(bool p0, address p1, bool p2, string memory p3) internal pure { |
| 1278 | _sendLogPayload(abi.encodeWithSignature("log(bool,address,bool,string)", p0, p1, p2, p3)); |
| 1279 | } |
| 1280 | |
| 1281 | function log(bool p0, address p1, bool p2, bool p3) internal pure { |
| 1282 | _sendLogPayload(abi.encodeWithSignature("log(bool,address,bool,bool)", p0, p1, p2, p3)); |
| 1283 | } |
| 1284 | |
| 1285 | function log(bool p0, address p1, bool p2, address p3) internal pure { |
| 1286 | _sendLogPayload(abi.encodeWithSignature("log(bool,address,bool,address)", p0, p1, p2, p3)); |
| 1287 | } |
| 1288 | |
| 1289 | function log(bool p0, address p1, address p2, uint256 p3) internal pure { |
| 1290 | _sendLogPayload(abi.encodeWithSignature("log(bool,address,address,uint256)", p0, p1, p2, p3)); |
| 1291 | } |
| 1292 | |
| 1293 | function log(bool p0, address p1, address p2, string memory p3) internal pure { |
| 1294 | _sendLogPayload(abi.encodeWithSignature("log(bool,address,address,string)", p0, p1, p2, p3)); |
| 1295 | } |
| 1296 | |
| 1297 | function log(bool p0, address p1, address p2, bool p3) internal pure { |
| 1298 | _sendLogPayload(abi.encodeWithSignature("log(bool,address,address,bool)", p0, p1, p2, p3)); |
| 1299 | } |
| 1300 | |
| 1301 | function log(bool p0, address p1, address p2, address p3) internal pure { |
| 1302 | _sendLogPayload(abi.encodeWithSignature("log(bool,address,address,address)", p0, p1, p2, p3)); |
| 1303 | } |
| 1304 | |
| 1305 | function log(address p0, uint256 p1, uint256 p2, uint256 p3) internal pure { |
| 1306 | _sendLogPayload(abi.encodeWithSignature("log(address,uint256,uint256,uint256)", p0, p1, p2, p3)); |
| 1307 | } |
| 1308 | |
| 1309 | function log(address p0, uint256 p1, uint256 p2, string memory p3) internal pure { |
| 1310 | _sendLogPayload(abi.encodeWithSignature("log(address,uint256,uint256,string)", p0, p1, p2, p3)); |
| 1311 | } |
| 1312 | |
| 1313 | function log(address p0, uint256 p1, uint256 p2, bool p3) internal pure { |
| 1314 | _sendLogPayload(abi.encodeWithSignature("log(address,uint256,uint256,bool)", p0, p1, p2, p3)); |
| 1315 | } |
| 1316 | |
| 1317 | function log(address p0, uint256 p1, uint256 p2, address p3) internal pure { |
| 1318 | _sendLogPayload(abi.encodeWithSignature("log(address,uint256,uint256,address)", p0, p1, p2, p3)); |
| 1319 | } |
| 1320 | |
| 1321 | function log(address p0, uint256 p1, string memory p2, uint256 p3) internal pure { |
| 1322 | _sendLogPayload(abi.encodeWithSignature("log(address,uint256,string,uint256)", p0, p1, p2, p3)); |
| 1323 | } |
| 1324 | |
| 1325 | function log(address p0, uint256 p1, string memory p2, string memory p3) internal pure { |
| 1326 | _sendLogPayload(abi.encodeWithSignature("log(address,uint256,string,string)", p0, p1, p2, p3)); |
| 1327 | } |
| 1328 | |
| 1329 | function log(address p0, uint256 p1, string memory p2, bool p3) internal pure { |
| 1330 | _sendLogPayload(abi.encodeWithSignature("log(address,uint256,string,bool)", p0, p1, p2, p3)); |
| 1331 | } |
| 1332 | |
| 1333 | function log(address p0, uint256 p1, string memory p2, address p3) internal pure { |
| 1334 | _sendLogPayload(abi.encodeWithSignature("log(address,uint256,string,address)", p0, p1, p2, p3)); |
| 1335 | } |
| 1336 | |
| 1337 | function log(address p0, uint256 p1, bool p2, uint256 p3) internal pure { |
| 1338 | _sendLogPayload(abi.encodeWithSignature("log(address,uint256,bool,uint256)", p0, p1, p2, p3)); |
| 1339 | } |
| 1340 | |
| 1341 | function log(address p0, uint256 p1, bool p2, string memory p3) internal pure { |
| 1342 | _sendLogPayload(abi.encodeWithSignature("log(address,uint256,bool,string)", p0, p1, p2, p3)); |
| 1343 | } |
| 1344 | |
| 1345 | function log(address p0, uint256 p1, bool p2, bool p3) internal pure { |
| 1346 | _sendLogPayload(abi.encodeWithSignature("log(address,uint256,bool,bool)", p0, p1, p2, p3)); |
| 1347 | } |
| 1348 | |
| 1349 | function log(address p0, uint256 p1, bool p2, address p3) internal pure { |
| 1350 | _sendLogPayload(abi.encodeWithSignature("log(address,uint256,bool,address)", p0, p1, p2, p3)); |
| 1351 | } |
| 1352 | |
| 1353 | function log(address p0, uint256 p1, address p2, uint256 p3) internal pure { |
| 1354 | _sendLogPayload(abi.encodeWithSignature("log(address,uint256,address,uint256)", p0, p1, p2, p3)); |
| 1355 | } |
| 1356 | |
| 1357 | function log(address p0, uint256 p1, address p2, string memory p3) internal pure { |
| 1358 | _sendLogPayload(abi.encodeWithSignature("log(address,uint256,address,string)", p0, p1, p2, p3)); |
| 1359 | } |
| 1360 | |
| 1361 | function log(address p0, uint256 p1, address p2, bool p3) internal pure { |
| 1362 | _sendLogPayload(abi.encodeWithSignature("log(address,uint256,address,bool)", p0, p1, p2, p3)); |
| 1363 | } |
| 1364 | |
| 1365 | function log(address p0, uint256 p1, address p2, address p3) internal pure { |
| 1366 | _sendLogPayload(abi.encodeWithSignature("log(address,uint256,address,address)", p0, p1, p2, p3)); |
| 1367 | } |
| 1368 | |
| 1369 | function log(address p0, string memory p1, uint256 p2, uint256 p3) internal pure { |
| 1370 | _sendLogPayload(abi.encodeWithSignature("log(address,string,uint256,uint256)", p0, p1, p2, p3)); |
| 1371 | } |
| 1372 | |
| 1373 | function log(address p0, string memory p1, uint256 p2, string memory p3) internal pure { |
| 1374 | _sendLogPayload(abi.encodeWithSignature("log(address,string,uint256,string)", p0, p1, p2, p3)); |
| 1375 | } |
| 1376 | |
| 1377 | function log(address p0, string memory p1, uint256 p2, bool p3) internal pure { |
| 1378 | _sendLogPayload(abi.encodeWithSignature("log(address,string,uint256,bool)", p0, p1, p2, p3)); |
| 1379 | } |
| 1380 | |
| 1381 | function log(address p0, string memory p1, uint256 p2, address p3) internal pure { |
| 1382 | _sendLogPayload(abi.encodeWithSignature("log(address,string,uint256,address)", p0, p1, p2, p3)); |
| 1383 | } |
| 1384 | |
| 1385 | function log(address p0, string memory p1, string memory p2, uint256 p3) internal pure { |
| 1386 | _sendLogPayload(abi.encodeWithSignature("log(address,string,string,uint256)", p0, p1, p2, p3)); |
| 1387 | } |
| 1388 | |
| 1389 | function log(address p0, string memory p1, string memory p2, string memory p3) internal pure { |
| 1390 | _sendLogPayload(abi.encodeWithSignature("log(address,string,string,string)", p0, p1, p2, p3)); |
| 1391 | } |
| 1392 | |
| 1393 | function log(address p0, string memory p1, string memory p2, bool p3) internal pure { |
| 1394 | _sendLogPayload(abi.encodeWithSignature("log(address,string,string,bool)", p0, p1, p2, p3)); |
| 1395 | } |
| 1396 | |
| 1397 | function log(address p0, string memory p1, string memory p2, address p3) internal pure { |
| 1398 | _sendLogPayload(abi.encodeWithSignature("log(address,string,string,address)", p0, p1, p2, p3)); |
| 1399 | } |
| 1400 | |
| 1401 | function log(address p0, string memory p1, bool p2, uint256 p3) internal pure { |
| 1402 | _sendLogPayload(abi.encodeWithSignature("log(address,string,bool,uint256)", p0, p1, p2, p3)); |
| 1403 | } |
| 1404 | |
| 1405 | function log(address p0, string memory p1, bool p2, string memory p3) internal pure { |
| 1406 | _sendLogPayload(abi.encodeWithSignature("log(address,string,bool,string)", p0, p1, p2, p3)); |
| 1407 | } |
| 1408 | |
| 1409 | function log(address p0, string memory p1, bool p2, bool p3) internal pure { |
| 1410 | _sendLogPayload(abi.encodeWithSignature("log(address,string,bool,bool)", p0, p1, p2, p3)); |
| 1411 | } |
| 1412 | |
| 1413 | function log(address p0, string memory p1, bool p2, address p3) internal pure { |
| 1414 | _sendLogPayload(abi.encodeWithSignature("log(address,string,bool,address)", p0, p1, p2, p3)); |
| 1415 | } |
| 1416 | |
| 1417 | function log(address p0, string memory p1, address p2, uint256 p3) internal pure { |
| 1418 | _sendLogPayload(abi.encodeWithSignature("log(address,string,address,uint256)", p0, p1, p2, p3)); |
| 1419 | } |
| 1420 | |
| 1421 | function log(address p0, string memory p1, address p2, string memory p3) internal pure { |
| 1422 | _sendLogPayload(abi.encodeWithSignature("log(address,string,address,string)", p0, p1, p2, p3)); |
| 1423 | } |
| 1424 | |
| 1425 | function log(address p0, string memory p1, address p2, bool p3) internal pure { |
| 1426 | _sendLogPayload(abi.encodeWithSignature("log(address,string,address,bool)", p0, p1, p2, p3)); |
| 1427 | } |
| 1428 | |
| 1429 | function log(address p0, string memory p1, address p2, address p3) internal pure { |
| 1430 | _sendLogPayload(abi.encodeWithSignature("log(address,string,address,address)", p0, p1, p2, p3)); |
| 1431 | } |
| 1432 | |
| 1433 | function log(address p0, bool p1, uint256 p2, uint256 p3) internal pure { |
| 1434 | _sendLogPayload(abi.encodeWithSignature("log(address,bool,uint256,uint256)", p0, p1, p2, p3)); |
| 1435 | } |
| 1436 | |
| 1437 | function log(address p0, bool p1, uint256 p2, string memory p3) internal pure { |
| 1438 | _sendLogPayload(abi.encodeWithSignature("log(address,bool,uint256,string)", p0, p1, p2, p3)); |
| 1439 | } |
| 1440 | |
| 1441 | function log(address p0, bool p1, uint256 p2, bool p3) internal pure { |
| 1442 | _sendLogPayload(abi.encodeWithSignature("log(address,bool,uint256,bool)", p0, p1, p2, p3)); |
| 1443 | } |
| 1444 | |
| 1445 | function log(address p0, bool p1, uint256 p2, address p3) internal pure { |
| 1446 | _sendLogPayload(abi.encodeWithSignature("log(address,bool,uint256,address)", p0, p1, p2, p3)); |
| 1447 | } |
| 1448 | |
| 1449 | function log(address p0, bool p1, string memory p2, uint256 p3) internal pure { |
| 1450 | _sendLogPayload(abi.encodeWithSignature("log(address,bool,string,uint256)", p0, p1, p2, p3)); |
| 1451 | } |
| 1452 | |
| 1453 | function log(address p0, bool p1, string memory p2, string memory p3) internal pure { |
| 1454 | _sendLogPayload(abi.encodeWithSignature("log(address,bool,string,string)", p0, p1, p2, p3)); |
| 1455 | } |
| 1456 | |
| 1457 | function log(address p0, bool p1, string memory p2, bool p3) internal pure { |
| 1458 | _sendLogPayload(abi.encodeWithSignature("log(address,bool,string,bool)", p0, p1, p2, p3)); |
| 1459 | } |
| 1460 | |
| 1461 | function log(address p0, bool p1, string memory p2, address p3) internal pure { |
| 1462 | _sendLogPayload(abi.encodeWithSignature("log(address,bool,string,address)", p0, p1, p2, p3)); |
| 1463 | } |
| 1464 | |
| 1465 | function log(address p0, bool p1, bool p2, uint256 p3) internal pure { |
| 1466 | _sendLogPayload(abi.encodeWithSignature("log(address,bool,bool,uint256)", p0, p1, p2, p3)); |
| 1467 | } |
| 1468 | |
| 1469 | function log(address p0, bool p1, bool p2, string memory p3) internal pure { |
| 1470 | _sendLogPayload(abi.encodeWithSignature("log(address,bool,bool,string)", p0, p1, p2, p3)); |
| 1471 | } |
| 1472 | |
| 1473 | function log(address p0, bool p1, bool p2, bool p3) internal pure { |
| 1474 | _sendLogPayload(abi.encodeWithSignature("log(address,bool,bool,bool)", p0, p1, p2, p3)); |
| 1475 | } |
| 1476 | |
| 1477 | function log(address p0, bool p1, bool p2, address p3) internal pure { |
| 1478 | _sendLogPayload(abi.encodeWithSignature("log(address,bool,bool,address)", p0, p1, p2, p3)); |
| 1479 | } |
| 1480 | |
| 1481 | function log(address p0, bool p1, address p2, uint256 p3) internal pure { |
| 1482 | _sendLogPayload(abi.encodeWithSignature("log(address,bool,address,uint256)", p0, p1, p2, p3)); |
| 1483 | } |
| 1484 | |
| 1485 | function log(address p0, bool p1, address p2, string memory p3) internal pure { |
| 1486 | _sendLogPayload(abi.encodeWithSignature("log(address,bool,address,string)", p0, p1, p2, p3)); |
| 1487 | } |
| 1488 | |
| 1489 | function log(address p0, bool p1, address p2, bool p3) internal pure { |
| 1490 | _sendLogPayload(abi.encodeWithSignature("log(address,bool,address,bool)", p0, p1, p2, p3)); |
| 1491 | } |
| 1492 | |
| 1493 | function log(address p0, bool p1, address p2, address p3) internal pure { |
| 1494 | _sendLogPayload(abi.encodeWithSignature("log(address,bool,address,address)", p0, p1, p2, p3)); |
| 1495 | } |
| 1496 | |
| 1497 | function log(address p0, address p1, uint256 p2, uint256 p3) internal pure { |
| 1498 | _sendLogPayload(abi.encodeWithSignature("log(address,address,uint256,uint256)", p0, p1, p2, p3)); |
| 1499 | } |
| 1500 | |
| 1501 | function log(address p0, address p1, uint256 p2, string memory p3) internal pure { |
| 1502 | _sendLogPayload(abi.encodeWithSignature("log(address,address,uint256,string)", p0, p1, p2, p3)); |
| 1503 | } |
| 1504 | |
| 1505 | function log(address p0, address p1, uint256 p2, bool p3) internal pure { |
| 1506 | _sendLogPayload(abi.encodeWithSignature("log(address,address,uint256,bool)", p0, p1, p2, p3)); |
| 1507 | } |
| 1508 | |
| 1509 | function log(address p0, address p1, uint256 p2, address p3) internal pure { |
| 1510 | _sendLogPayload(abi.encodeWithSignature("log(address,address,uint256,address)", p0, p1, p2, p3)); |
| 1511 | } |
| 1512 | |
| 1513 | function log(address p0, address p1, string memory p2, uint256 p3) internal pure { |
| 1514 | _sendLogPayload(abi.encodeWithSignature("log(address,address,string,uint256)", p0, p1, p2, p3)); |
| 1515 | } |
| 1516 | |
| 1517 | function log(address p0, address p1, string memory p2, string memory p3) internal pure { |
| 1518 | _sendLogPayload(abi.encodeWithSignature("log(address,address,string,string)", p0, p1, p2, p3)); |
| 1519 | } |
| 1520 | |
| 1521 | function log(address p0, address p1, string memory p2, bool p3) internal pure { |
| 1522 | _sendLogPayload(abi.encodeWithSignature("log(address,address,string,bool)", p0, p1, p2, p3)); |
| 1523 | } |
| 1524 | |
| 1525 | function log(address p0, address p1, string memory p2, address p3) internal pure { |
| 1526 | _sendLogPayload(abi.encodeWithSignature("log(address,address,string,address)", p0, p1, p2, p3)); |
| 1527 | } |
| 1528 | |
| 1529 | function log(address p0, address p1, bool p2, uint256 p3) internal pure { |
| 1530 | _sendLogPayload(abi.encodeWithSignature("log(address,address,bool,uint256)", p0, p1, p2, p3)); |
| 1531 | } |
| 1532 | |
| 1533 | function log(address p0, address p1, bool p2, string memory p3) internal pure { |
| 1534 | _sendLogPayload(abi.encodeWithSignature("log(address,address,bool,string)", p0, p1, p2, p3)); |
| 1535 | } |
| 1536 | |
| 1537 | function log(address p0, address p1, bool p2, bool p3) internal pure { |
| 1538 | _sendLogPayload(abi.encodeWithSignature("log(address,address,bool,bool)", p0, p1, p2, p3)); |
| 1539 | } |
| 1540 | |
| 1541 | function log(address p0, address p1, bool p2, address p3) internal pure { |
| 1542 | _sendLogPayload(abi.encodeWithSignature("log(address,address,bool,address)", p0, p1, p2, p3)); |
| 1543 | } |
| 1544 | |
| 1545 | function log(address p0, address p1, address p2, uint256 p3) internal pure { |
| 1546 | _sendLogPayload(abi.encodeWithSignature("log(address,address,address,uint256)", p0, p1, p2, p3)); |
| 1547 | } |
| 1548 | |
| 1549 | function log(address p0, address p1, address p2, string memory p3) internal pure { |
| 1550 | _sendLogPayload(abi.encodeWithSignature("log(address,address,address,string)", p0, p1, p2, p3)); |
| 1551 | } |
| 1552 | |
| 1553 | function log(address p0, address p1, address p2, bool p3) internal pure { |
| 1554 | _sendLogPayload(abi.encodeWithSignature("log(address,address,address,bool)", p0, p1, p2, p3)); |
| 1555 | } |
| 1556 | |
| 1557 | function log(address p0, address p1, address p2, address p3) internal pure { |
| 1558 | _sendLogPayload(abi.encodeWithSignature("log(address,address,address,address)", p0, p1, p2, p3)); |
| 1559 | } |
| 1560 | } |
| 1561 |
0.0%
lib/forge-std/src/console2.sol
Lines covered: 0 / 0 (0.0%)
| 1 | // SPDX-License-Identifier: MIT |
| 2 | pragma solidity >=0.4.22 <0.9.0; |
| 3 | |
| 4 | import {console as console2} from "./console.sol"; |
| 5 |
0.0%
lib/forge-std/src/interfaces/IMulticall3.sol
Lines covered: 0 / 0 (0.0%)
| 1 | // SPDX-License-Identifier: MIT |
| 2 | pragma solidity >=0.6.2 <0.9.0; |
| 3 | |
| 4 | pragma experimental ABIEncoderV2; |
| 5 | |
| 6 | interface IMulticall3 { |
| 7 | struct Call { |
| 8 | address target; |
| 9 | bytes callData; |
| 10 | } |
| 11 | |
| 12 | struct Call3 { |
| 13 | address target; |
| 14 | bool allowFailure; |
| 15 | bytes callData; |
| 16 | } |
| 17 | |
| 18 | struct Call3Value { |
| 19 | address target; |
| 20 | bool allowFailure; |
| 21 | uint256 value; |
| 22 | bytes callData; |
| 23 | } |
| 24 | |
| 25 | struct Result { |
| 26 | bool success; |
| 27 | bytes returnData; |
| 28 | } |
| 29 | |
| 30 | function aggregate(Call[] calldata calls) external payable returns (uint256 blockNumber, bytes[] memory returnData); |
| 31 | |
| 32 | function aggregate3(Call3[] calldata calls) external payable returns (Result[] memory returnData); |
| 33 | |
| 34 | function aggregate3Value(Call3Value[] calldata calls) external payable returns (Result[] memory returnData); |
| 35 | |
| 36 | function blockAndAggregate(Call[] calldata calls) |
| 37 | external |
| 38 | payable |
| 39 | returns (uint256 blockNumber, bytes32 blockHash, Result[] memory returnData); |
| 40 | |
| 41 | function getBasefee() external view returns (uint256 basefee); |
| 42 | |
| 43 | function getBlockHash(uint256 blockNumber) external view returns (bytes32 blockHash); |
| 44 | |
| 45 | function getBlockNumber() external view returns (uint256 blockNumber); |
| 46 | |
| 47 | function getChainId() external view returns (uint256 chainid); |
| 48 | |
| 49 | function getCurrentBlockCoinbase() external view returns (address coinbase); |
| 50 | |
| 51 | function getCurrentBlockDifficulty() external view returns (uint256 difficulty); |
| 52 | |
| 53 | function getCurrentBlockGasLimit() external view returns (uint256 gaslimit); |
| 54 | |
| 55 | function getCurrentBlockTimestamp() external view returns (uint256 timestamp); |
| 56 | |
| 57 | function getEthBalance(address addr) external view returns (uint256 balance); |
| 58 | |
| 59 | function getLastBlockHash() external view returns (bytes32 blockHash); |
| 60 | |
| 61 | function tryAggregate(bool requireSuccess, Call[] calldata calls) |
| 62 | external |
| 63 | payable |
| 64 | returns (Result[] memory returnData); |
| 65 | |
| 66 | function tryBlockAndAggregate(bool requireSuccess, Call[] calldata calls) |
| 67 | external |
| 68 | payable |
| 69 | returns (uint256 blockNumber, bytes32 blockHash, Result[] memory returnData); |
| 70 | } |
| 71 |
0.0%
lib/forge-std/src/safeconsole.sol
Lines covered: 0 / 1 (0.0%)
| 1 | // SPDX-License-Identifier: MIT |
| 2 | pragma solidity >=0.6.2 <0.9.0; |
| 3 | |
| 4 | /// @author philogy <https://github.com/philogy> |
| 5 | /// @dev Code generated automatically by script. |
| 6 | library safeconsole { |
| 7 | uint256 constant CONSOLE_ADDR = 0x000000000000000000000000000000000000000000636F6e736F6c652e6c6f67; |
| 8 | |
| 9 | // Credit to [0age](https://twitter.com/z0age/status/1654922202930888704) and [0xdapper](https://github.com/foundry-rs/forge-std/pull/374) |
| 10 | // for the view-to-pure log trick. |
| 11 | function _sendLogPayload(uint256 offset, uint256 size) private pure { |
| 12 | function(uint256, uint256) internal view fnIn = _sendLogPayloadView; |
| 13 | function(uint256, uint256) internal pure pureSendLogPayload; |
| 14 | /// @solidity memory-safe-assembly |
| 15 | assembly { |
| 16 | pureSendLogPayload := fnIn |
| 17 | } |
| 18 | pureSendLogPayload(offset, size); |
| 19 | } |
| 20 | |
| 21 | function _sendLogPayloadView(uint256 offset, uint256 size) private view { |
| 22 | /// @solidity memory-safe-assembly |
| 23 | assembly { |
| 24 | pop(staticcall(gas(), CONSOLE_ADDR, offset, size, 0x0, 0x0)) |
| 25 | } |
| 26 | } |
| 27 | |
| 28 | function _memcopy(uint256 fromOffset, uint256 toOffset, uint256 length) private pure { |
| 29 | function(uint256, uint256, uint256) internal view fnIn = _memcopyView; |
| 30 | function(uint256, uint256, uint256) internal pure pureMemcopy; |
| 31 | /// @solidity memory-safe-assembly |
| 32 | assembly { |
| 33 | pureMemcopy := fnIn |
| 34 | } |
| 35 | pureMemcopy(fromOffset, toOffset, length); |
| 36 | } |
| 37 | |
| 38 | function _memcopyView(uint256 fromOffset, uint256 toOffset, uint256 length) private view { |
| 39 | /// @solidity memory-safe-assembly |
| 40 | assembly { |
| 41 | pop(staticcall(gas(), 0x4, fromOffset, length, toOffset, length)) |
| 42 | } |
| 43 | } |
| 44 | |
| 45 | function logMemory(uint256 offset, uint256 length) internal pure { |
| 46 | if (offset >= 0x60) { |
| 47 | // Sufficient memory before slice to prepare call header. |
| 48 | bytes32 m0; |
| 49 | bytes32 m1; |
| 50 | bytes32 m2; |
| 51 | /// @solidity memory-safe-assembly |
| 52 | assembly { |
| 53 | m0 := mload(sub(offset, 0x60)) |
| 54 | m1 := mload(sub(offset, 0x40)) |
| 55 | m2 := mload(sub(offset, 0x20)) |
| 56 | // Selector of `log(bytes)`. |
| 57 | mstore(sub(offset, 0x60), 0x0be77f56) |
| 58 | mstore(sub(offset, 0x40), 0x20) |
| 59 | mstore(sub(offset, 0x20), length) |
| 60 | } |
| 61 | _sendLogPayload(offset - 0x44, length + 0x44); |
| 62 | /// @solidity memory-safe-assembly |
| 63 | assembly { |
| 64 | mstore(sub(offset, 0x60), m0) |
| 65 | mstore(sub(offset, 0x40), m1) |
| 66 | mstore(sub(offset, 0x20), m2) |
| 67 | } |
| 68 | } else { |
| 69 | // Insufficient space, so copy slice forward, add header and reverse. |
| 70 | bytes32 m0; |
| 71 | bytes32 m1; |
| 72 | bytes32 m2; |
| 73 | uint256 endOffset = offset + length; |
| 74 | /// @solidity memory-safe-assembly |
| 75 | assembly { |
| 76 | m0 := mload(add(endOffset, 0x00)) |
| 77 | m1 := mload(add(endOffset, 0x20)) |
| 78 | m2 := mload(add(endOffset, 0x40)) |
| 79 | } |
| 80 | _memcopy(offset, offset + 0x60, length); |
| 81 | /// @solidity memory-safe-assembly |
| 82 | assembly { |
| 83 | // Selector of `log(bytes)`. |
| 84 | mstore(add(offset, 0x00), 0x0be77f56) |
| 85 | mstore(add(offset, 0x20), 0x20) |
| 86 | mstore(add(offset, 0x40), length) |
| 87 | } |
| 88 | _sendLogPayload(offset + 0x1c, length + 0x44); |
| 89 | _memcopy(offset + 0x60, offset, length); |
| 90 | /// @solidity memory-safe-assembly |
| 91 | assembly { |
| 92 | mstore(add(endOffset, 0x00), m0) |
| 93 | mstore(add(endOffset, 0x20), m1) |
| 94 | mstore(add(endOffset, 0x40), m2) |
| 95 | } |
| 96 | } |
| 97 | } |
| 98 | |
| 99 | function log(address p0) internal pure { |
| 100 | bytes32 m0; |
| 101 | bytes32 m1; |
| 102 | /// @solidity memory-safe-assembly |
| 103 | assembly { |
| 104 | m0 := mload(0x00) |
| 105 | m1 := mload(0x20) |
| 106 | // Selector of `log(address)`. |
| 107 | mstore(0x00, 0x2c2ecbc2) |
| 108 | mstore(0x20, p0) |
| 109 | } |
| 110 | _sendLogPayload(0x1c, 0x24); |
| 111 | /// @solidity memory-safe-assembly |
| 112 | assembly { |
| 113 | mstore(0x00, m0) |
| 114 | mstore(0x20, m1) |
| 115 | } |
| 116 | } |
| 117 | |
| 118 | function log(bool p0) internal pure { |
| 119 | bytes32 m0; |
| 120 | bytes32 m1; |
| 121 | /// @solidity memory-safe-assembly |
| 122 | assembly { |
| 123 | m0 := mload(0x00) |
| 124 | m1 := mload(0x20) |
| 125 | // Selector of `log(bool)`. |
| 126 | mstore(0x00, 0x32458eed) |
| 127 | mstore(0x20, p0) |
| 128 | } |
| 129 | _sendLogPayload(0x1c, 0x24); |
| 130 | /// @solidity memory-safe-assembly |
| 131 | assembly { |
| 132 | mstore(0x00, m0) |
| 133 | mstore(0x20, m1) |
| 134 | } |
| 135 | } |
| 136 | |
| 137 | function log(uint256 p0) internal pure { |
| 138 | bytes32 m0; |
| 139 | bytes32 m1; |
| 140 | /// @solidity memory-safe-assembly |
| 141 | assembly { |
| 142 | m0 := mload(0x00) |
| 143 | m1 := mload(0x20) |
| 144 | // Selector of `log(uint256)`. |
| 145 | mstore(0x00, 0xf82c50f1) |
| 146 | mstore(0x20, p0) |
| 147 | } |
| 148 | _sendLogPayload(0x1c, 0x24); |
| 149 | /// @solidity memory-safe-assembly |
| 150 | assembly { |
| 151 | mstore(0x00, m0) |
| 152 | mstore(0x20, m1) |
| 153 | } |
| 154 | } |
| 155 | |
| 156 | function log(bytes32 p0) internal pure { |
| 157 | bytes32 m0; |
| 158 | bytes32 m1; |
| 159 | bytes32 m2; |
| 160 | bytes32 m3; |
| 161 | /// @solidity memory-safe-assembly |
| 162 | assembly { |
| 163 | function writeString(pos, w) { |
| 164 | let length := 0 |
| 165 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 166 | mstore(pos, length) |
| 167 | let shift := sub(256, shl(3, length)) |
| 168 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 169 | } |
| 170 | m0 := mload(0x00) |
| 171 | m1 := mload(0x20) |
| 172 | m2 := mload(0x40) |
| 173 | m3 := mload(0x60) |
| 174 | // Selector of `log(string)`. |
| 175 | mstore(0x00, 0x41304fac) |
| 176 | mstore(0x20, 0x20) |
| 177 | writeString(0x40, p0) |
| 178 | } |
| 179 | _sendLogPayload(0x1c, 0x64); |
| 180 | /// @solidity memory-safe-assembly |
| 181 | assembly { |
| 182 | mstore(0x00, m0) |
| 183 | mstore(0x20, m1) |
| 184 | mstore(0x40, m2) |
| 185 | mstore(0x60, m3) |
| 186 | } |
| 187 | } |
| 188 | |
| 189 | function log(address p0, address p1) internal pure { |
| 190 | bytes32 m0; |
| 191 | bytes32 m1; |
| 192 | bytes32 m2; |
| 193 | /// @solidity memory-safe-assembly |
| 194 | assembly { |
| 195 | m0 := mload(0x00) |
| 196 | m1 := mload(0x20) |
| 197 | m2 := mload(0x40) |
| 198 | // Selector of `log(address,address)`. |
| 199 | mstore(0x00, 0xdaf0d4aa) |
| 200 | mstore(0x20, p0) |
| 201 | mstore(0x40, p1) |
| 202 | } |
| 203 | _sendLogPayload(0x1c, 0x44); |
| 204 | /// @solidity memory-safe-assembly |
| 205 | assembly { |
| 206 | mstore(0x00, m0) |
| 207 | mstore(0x20, m1) |
| 208 | mstore(0x40, m2) |
| 209 | } |
| 210 | } |
| 211 | |
| 212 | function log(address p0, bool p1) internal pure { |
| 213 | bytes32 m0; |
| 214 | bytes32 m1; |
| 215 | bytes32 m2; |
| 216 | /// @solidity memory-safe-assembly |
| 217 | assembly { |
| 218 | m0 := mload(0x00) |
| 219 | m1 := mload(0x20) |
| 220 | m2 := mload(0x40) |
| 221 | // Selector of `log(address,bool)`. |
| 222 | mstore(0x00, 0x75b605d3) |
| 223 | mstore(0x20, p0) |
| 224 | mstore(0x40, p1) |
| 225 | } |
| 226 | _sendLogPayload(0x1c, 0x44); |
| 227 | /// @solidity memory-safe-assembly |
| 228 | assembly { |
| 229 | mstore(0x00, m0) |
| 230 | mstore(0x20, m1) |
| 231 | mstore(0x40, m2) |
| 232 | } |
| 233 | } |
| 234 | |
| 235 | function log(address p0, uint256 p1) internal pure { |
| 236 | bytes32 m0; |
| 237 | bytes32 m1; |
| 238 | bytes32 m2; |
| 239 | /// @solidity memory-safe-assembly |
| 240 | assembly { |
| 241 | m0 := mload(0x00) |
| 242 | m1 := mload(0x20) |
| 243 | m2 := mload(0x40) |
| 244 | // Selector of `log(address,uint256)`. |
| 245 | mstore(0x00, 0x8309e8a8) |
| 246 | mstore(0x20, p0) |
| 247 | mstore(0x40, p1) |
| 248 | } |
| 249 | _sendLogPayload(0x1c, 0x44); |
| 250 | /// @solidity memory-safe-assembly |
| 251 | assembly { |
| 252 | mstore(0x00, m0) |
| 253 | mstore(0x20, m1) |
| 254 | mstore(0x40, m2) |
| 255 | } |
| 256 | } |
| 257 | |
| 258 | function log(address p0, bytes32 p1) internal pure { |
| 259 | bytes32 m0; |
| 260 | bytes32 m1; |
| 261 | bytes32 m2; |
| 262 | bytes32 m3; |
| 263 | bytes32 m4; |
| 264 | /// @solidity memory-safe-assembly |
| 265 | assembly { |
| 266 | function writeString(pos, w) { |
| 267 | let length := 0 |
| 268 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 269 | mstore(pos, length) |
| 270 | let shift := sub(256, shl(3, length)) |
| 271 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 272 | } |
| 273 | m0 := mload(0x00) |
| 274 | m1 := mload(0x20) |
| 275 | m2 := mload(0x40) |
| 276 | m3 := mload(0x60) |
| 277 | m4 := mload(0x80) |
| 278 | // Selector of `log(address,string)`. |
| 279 | mstore(0x00, 0x759f86bb) |
| 280 | mstore(0x20, p0) |
| 281 | mstore(0x40, 0x40) |
| 282 | writeString(0x60, p1) |
| 283 | } |
| 284 | _sendLogPayload(0x1c, 0x84); |
| 285 | /// @solidity memory-safe-assembly |
| 286 | assembly { |
| 287 | mstore(0x00, m0) |
| 288 | mstore(0x20, m1) |
| 289 | mstore(0x40, m2) |
| 290 | mstore(0x60, m3) |
| 291 | mstore(0x80, m4) |
| 292 | } |
| 293 | } |
| 294 | |
| 295 | function log(bool p0, address p1) internal pure { |
| 296 | bytes32 m0; |
| 297 | bytes32 m1; |
| 298 | bytes32 m2; |
| 299 | /// @solidity memory-safe-assembly |
| 300 | assembly { |
| 301 | m0 := mload(0x00) |
| 302 | m1 := mload(0x20) |
| 303 | m2 := mload(0x40) |
| 304 | // Selector of `log(bool,address)`. |
| 305 | mstore(0x00, 0x853c4849) |
| 306 | mstore(0x20, p0) |
| 307 | mstore(0x40, p1) |
| 308 | } |
| 309 | _sendLogPayload(0x1c, 0x44); |
| 310 | /// @solidity memory-safe-assembly |
| 311 | assembly { |
| 312 | mstore(0x00, m0) |
| 313 | mstore(0x20, m1) |
| 314 | mstore(0x40, m2) |
| 315 | } |
| 316 | } |
| 317 | |
| 318 | function log(bool p0, bool p1) internal pure { |
| 319 | bytes32 m0; |
| 320 | bytes32 m1; |
| 321 | bytes32 m2; |
| 322 | /// @solidity memory-safe-assembly |
| 323 | assembly { |
| 324 | m0 := mload(0x00) |
| 325 | m1 := mload(0x20) |
| 326 | m2 := mload(0x40) |
| 327 | // Selector of `log(bool,bool)`. |
| 328 | mstore(0x00, 0x2a110e83) |
| 329 | mstore(0x20, p0) |
| 330 | mstore(0x40, p1) |
| 331 | } |
| 332 | _sendLogPayload(0x1c, 0x44); |
| 333 | /// @solidity memory-safe-assembly |
| 334 | assembly { |
| 335 | mstore(0x00, m0) |
| 336 | mstore(0x20, m1) |
| 337 | mstore(0x40, m2) |
| 338 | } |
| 339 | } |
| 340 | |
| 341 | function log(bool p0, uint256 p1) internal pure { |
| 342 | bytes32 m0; |
| 343 | bytes32 m1; |
| 344 | bytes32 m2; |
| 345 | /// @solidity memory-safe-assembly |
| 346 | assembly { |
| 347 | m0 := mload(0x00) |
| 348 | m1 := mload(0x20) |
| 349 | m2 := mload(0x40) |
| 350 | // Selector of `log(bool,uint256)`. |
| 351 | mstore(0x00, 0x399174d3) |
| 352 | mstore(0x20, p0) |
| 353 | mstore(0x40, p1) |
| 354 | } |
| 355 | _sendLogPayload(0x1c, 0x44); |
| 356 | /// @solidity memory-safe-assembly |
| 357 | assembly { |
| 358 | mstore(0x00, m0) |
| 359 | mstore(0x20, m1) |
| 360 | mstore(0x40, m2) |
| 361 | } |
| 362 | } |
| 363 | |
| 364 | function log(bool p0, bytes32 p1) internal pure { |
| 365 | bytes32 m0; |
| 366 | bytes32 m1; |
| 367 | bytes32 m2; |
| 368 | bytes32 m3; |
| 369 | bytes32 m4; |
| 370 | /// @solidity memory-safe-assembly |
| 371 | assembly { |
| 372 | function writeString(pos, w) { |
| 373 | let length := 0 |
| 374 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 375 | mstore(pos, length) |
| 376 | let shift := sub(256, shl(3, length)) |
| 377 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 378 | } |
| 379 | m0 := mload(0x00) |
| 380 | m1 := mload(0x20) |
| 381 | m2 := mload(0x40) |
| 382 | m3 := mload(0x60) |
| 383 | m4 := mload(0x80) |
| 384 | // Selector of `log(bool,string)`. |
| 385 | mstore(0x00, 0x8feac525) |
| 386 | mstore(0x20, p0) |
| 387 | mstore(0x40, 0x40) |
| 388 | writeString(0x60, p1) |
| 389 | } |
| 390 | _sendLogPayload(0x1c, 0x84); |
| 391 | /// @solidity memory-safe-assembly |
| 392 | assembly { |
| 393 | mstore(0x00, m0) |
| 394 | mstore(0x20, m1) |
| 395 | mstore(0x40, m2) |
| 396 | mstore(0x60, m3) |
| 397 | mstore(0x80, m4) |
| 398 | } |
| 399 | } |
| 400 | |
| 401 | function log(uint256 p0, address p1) internal pure { |
| 402 | bytes32 m0; |
| 403 | bytes32 m1; |
| 404 | bytes32 m2; |
| 405 | /// @solidity memory-safe-assembly |
| 406 | assembly { |
| 407 | m0 := mload(0x00) |
| 408 | m1 := mload(0x20) |
| 409 | m2 := mload(0x40) |
| 410 | // Selector of `log(uint256,address)`. |
| 411 | mstore(0x00, 0x69276c86) |
| 412 | mstore(0x20, p0) |
| 413 | mstore(0x40, p1) |
| 414 | } |
| 415 | _sendLogPayload(0x1c, 0x44); |
| 416 | /// @solidity memory-safe-assembly |
| 417 | assembly { |
| 418 | mstore(0x00, m0) |
| 419 | mstore(0x20, m1) |
| 420 | mstore(0x40, m2) |
| 421 | } |
| 422 | } |
| 423 | |
| 424 | function log(uint256 p0, bool p1) internal pure { |
| 425 | bytes32 m0; |
| 426 | bytes32 m1; |
| 427 | bytes32 m2; |
| 428 | /// @solidity memory-safe-assembly |
| 429 | assembly { |
| 430 | m0 := mload(0x00) |
| 431 | m1 := mload(0x20) |
| 432 | m2 := mload(0x40) |
| 433 | // Selector of `log(uint256,bool)`. |
| 434 | mstore(0x00, 0x1c9d7eb3) |
| 435 | mstore(0x20, p0) |
| 436 | mstore(0x40, p1) |
| 437 | } |
| 438 | _sendLogPayload(0x1c, 0x44); |
| 439 | /// @solidity memory-safe-assembly |
| 440 | assembly { |
| 441 | mstore(0x00, m0) |
| 442 | mstore(0x20, m1) |
| 443 | mstore(0x40, m2) |
| 444 | } |
| 445 | } |
| 446 | |
| 447 | function log(uint256 p0, uint256 p1) internal pure { |
| 448 | bytes32 m0; |
| 449 | bytes32 m1; |
| 450 | bytes32 m2; |
| 451 | /// @solidity memory-safe-assembly |
| 452 | assembly { |
| 453 | m0 := mload(0x00) |
| 454 | m1 := mload(0x20) |
| 455 | m2 := mload(0x40) |
| 456 | // Selector of `log(uint256,uint256)`. |
| 457 | mstore(0x00, 0xf666715a) |
| 458 | mstore(0x20, p0) |
| 459 | mstore(0x40, p1) |
| 460 | } |
| 461 | _sendLogPayload(0x1c, 0x44); |
| 462 | /// @solidity memory-safe-assembly |
| 463 | assembly { |
| 464 | mstore(0x00, m0) |
| 465 | mstore(0x20, m1) |
| 466 | mstore(0x40, m2) |
| 467 | } |
| 468 | } |
| 469 | |
| 470 | function log(uint256 p0, bytes32 p1) internal pure { |
| 471 | bytes32 m0; |
| 472 | bytes32 m1; |
| 473 | bytes32 m2; |
| 474 | bytes32 m3; |
| 475 | bytes32 m4; |
| 476 | /// @solidity memory-safe-assembly |
| 477 | assembly { |
| 478 | function writeString(pos, w) { |
| 479 | let length := 0 |
| 480 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 481 | mstore(pos, length) |
| 482 | let shift := sub(256, shl(3, length)) |
| 483 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 484 | } |
| 485 | m0 := mload(0x00) |
| 486 | m1 := mload(0x20) |
| 487 | m2 := mload(0x40) |
| 488 | m3 := mload(0x60) |
| 489 | m4 := mload(0x80) |
| 490 | // Selector of `log(uint256,string)`. |
| 491 | mstore(0x00, 0x643fd0df) |
| 492 | mstore(0x20, p0) |
| 493 | mstore(0x40, 0x40) |
| 494 | writeString(0x60, p1) |
| 495 | } |
| 496 | _sendLogPayload(0x1c, 0x84); |
| 497 | /// @solidity memory-safe-assembly |
| 498 | assembly { |
| 499 | mstore(0x00, m0) |
| 500 | mstore(0x20, m1) |
| 501 | mstore(0x40, m2) |
| 502 | mstore(0x60, m3) |
| 503 | mstore(0x80, m4) |
| 504 | } |
| 505 | } |
| 506 | |
| 507 | function log(bytes32 p0, address p1) internal pure { |
| 508 | bytes32 m0; |
| 509 | bytes32 m1; |
| 510 | bytes32 m2; |
| 511 | bytes32 m3; |
| 512 | bytes32 m4; |
| 513 | /// @solidity memory-safe-assembly |
| 514 | assembly { |
| 515 | function writeString(pos, w) { |
| 516 | let length := 0 |
| 517 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 518 | mstore(pos, length) |
| 519 | let shift := sub(256, shl(3, length)) |
| 520 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 521 | } |
| 522 | m0 := mload(0x00) |
| 523 | m1 := mload(0x20) |
| 524 | m2 := mload(0x40) |
| 525 | m3 := mload(0x60) |
| 526 | m4 := mload(0x80) |
| 527 | // Selector of `log(string,address)`. |
| 528 | mstore(0x00, 0x319af333) |
| 529 | mstore(0x20, 0x40) |
| 530 | mstore(0x40, p1) |
| 531 | writeString(0x60, p0) |
| 532 | } |
| 533 | _sendLogPayload(0x1c, 0x84); |
| 534 | /// @solidity memory-safe-assembly |
| 535 | assembly { |
| 536 | mstore(0x00, m0) |
| 537 | mstore(0x20, m1) |
| 538 | mstore(0x40, m2) |
| 539 | mstore(0x60, m3) |
| 540 | mstore(0x80, m4) |
| 541 | } |
| 542 | } |
| 543 | |
| 544 | function log(bytes32 p0, bool p1) internal pure { |
| 545 | bytes32 m0; |
| 546 | bytes32 m1; |
| 547 | bytes32 m2; |
| 548 | bytes32 m3; |
| 549 | bytes32 m4; |
| 550 | /// @solidity memory-safe-assembly |
| 551 | assembly { |
| 552 | function writeString(pos, w) { |
| 553 | let length := 0 |
| 554 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 555 | mstore(pos, length) |
| 556 | let shift := sub(256, shl(3, length)) |
| 557 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 558 | } |
| 559 | m0 := mload(0x00) |
| 560 | m1 := mload(0x20) |
| 561 | m2 := mload(0x40) |
| 562 | m3 := mload(0x60) |
| 563 | m4 := mload(0x80) |
| 564 | // Selector of `log(string,bool)`. |
| 565 | mstore(0x00, 0xc3b55635) |
| 566 | mstore(0x20, 0x40) |
| 567 | mstore(0x40, p1) |
| 568 | writeString(0x60, p0) |
| 569 | } |
| 570 | _sendLogPayload(0x1c, 0x84); |
| 571 | /// @solidity memory-safe-assembly |
| 572 | assembly { |
| 573 | mstore(0x00, m0) |
| 574 | mstore(0x20, m1) |
| 575 | mstore(0x40, m2) |
| 576 | mstore(0x60, m3) |
| 577 | mstore(0x80, m4) |
| 578 | } |
| 579 | } |
| 580 | |
| 581 | function log(bytes32 p0, uint256 p1) internal pure { |
| 582 | bytes32 m0; |
| 583 | bytes32 m1; |
| 584 | bytes32 m2; |
| 585 | bytes32 m3; |
| 586 | bytes32 m4; |
| 587 | /// @solidity memory-safe-assembly |
| 588 | assembly { |
| 589 | function writeString(pos, w) { |
| 590 | let length := 0 |
| 591 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 592 | mstore(pos, length) |
| 593 | let shift := sub(256, shl(3, length)) |
| 594 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 595 | } |
| 596 | m0 := mload(0x00) |
| 597 | m1 := mload(0x20) |
| 598 | m2 := mload(0x40) |
| 599 | m3 := mload(0x60) |
| 600 | m4 := mload(0x80) |
| 601 | // Selector of `log(string,uint256)`. |
| 602 | mstore(0x00, 0xb60e72cc) |
| 603 | mstore(0x20, 0x40) |
| 604 | mstore(0x40, p1) |
| 605 | writeString(0x60, p0) |
| 606 | } |
| 607 | _sendLogPayload(0x1c, 0x84); |
| 608 | /// @solidity memory-safe-assembly |
| 609 | assembly { |
| 610 | mstore(0x00, m0) |
| 611 | mstore(0x20, m1) |
| 612 | mstore(0x40, m2) |
| 613 | mstore(0x60, m3) |
| 614 | mstore(0x80, m4) |
| 615 | } |
| 616 | } |
| 617 | |
| 618 | function log(bytes32 p0, bytes32 p1) internal pure { |
| 619 | bytes32 m0; |
| 620 | bytes32 m1; |
| 621 | bytes32 m2; |
| 622 | bytes32 m3; |
| 623 | bytes32 m4; |
| 624 | bytes32 m5; |
| 625 | bytes32 m6; |
| 626 | /// @solidity memory-safe-assembly |
| 627 | assembly { |
| 628 | function writeString(pos, w) { |
| 629 | let length := 0 |
| 630 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 631 | mstore(pos, length) |
| 632 | let shift := sub(256, shl(3, length)) |
| 633 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 634 | } |
| 635 | m0 := mload(0x00) |
| 636 | m1 := mload(0x20) |
| 637 | m2 := mload(0x40) |
| 638 | m3 := mload(0x60) |
| 639 | m4 := mload(0x80) |
| 640 | m5 := mload(0xa0) |
| 641 | m6 := mload(0xc0) |
| 642 | // Selector of `log(string,string)`. |
| 643 | mstore(0x00, 0x4b5c4277) |
| 644 | mstore(0x20, 0x40) |
| 645 | mstore(0x40, 0x80) |
| 646 | writeString(0x60, p0) |
| 647 | writeString(0xa0, p1) |
| 648 | } |
| 649 | _sendLogPayload(0x1c, 0xc4); |
| 650 | /// @solidity memory-safe-assembly |
| 651 | assembly { |
| 652 | mstore(0x00, m0) |
| 653 | mstore(0x20, m1) |
| 654 | mstore(0x40, m2) |
| 655 | mstore(0x60, m3) |
| 656 | mstore(0x80, m4) |
| 657 | mstore(0xa0, m5) |
| 658 | mstore(0xc0, m6) |
| 659 | } |
| 660 | } |
| 661 | |
| 662 | function log(address p0, address p1, address p2) internal pure { |
| 663 | bytes32 m0; |
| 664 | bytes32 m1; |
| 665 | bytes32 m2; |
| 666 | bytes32 m3; |
| 667 | /// @solidity memory-safe-assembly |
| 668 | assembly { |
| 669 | m0 := mload(0x00) |
| 670 | m1 := mload(0x20) |
| 671 | m2 := mload(0x40) |
| 672 | m3 := mload(0x60) |
| 673 | // Selector of `log(address,address,address)`. |
| 674 | mstore(0x00, 0x018c84c2) |
| 675 | mstore(0x20, p0) |
| 676 | mstore(0x40, p1) |
| 677 | mstore(0x60, p2) |
| 678 | } |
| 679 | _sendLogPayload(0x1c, 0x64); |
| 680 | /// @solidity memory-safe-assembly |
| 681 | assembly { |
| 682 | mstore(0x00, m0) |
| 683 | mstore(0x20, m1) |
| 684 | mstore(0x40, m2) |
| 685 | mstore(0x60, m3) |
| 686 | } |
| 687 | } |
| 688 | |
| 689 | function log(address p0, address p1, bool p2) internal pure { |
| 690 | bytes32 m0; |
| 691 | bytes32 m1; |
| 692 | bytes32 m2; |
| 693 | bytes32 m3; |
| 694 | /// @solidity memory-safe-assembly |
| 695 | assembly { |
| 696 | m0 := mload(0x00) |
| 697 | m1 := mload(0x20) |
| 698 | m2 := mload(0x40) |
| 699 | m3 := mload(0x60) |
| 700 | // Selector of `log(address,address,bool)`. |
| 701 | mstore(0x00, 0xf2a66286) |
| 702 | mstore(0x20, p0) |
| 703 | mstore(0x40, p1) |
| 704 | mstore(0x60, p2) |
| 705 | } |
| 706 | _sendLogPayload(0x1c, 0x64); |
| 707 | /// @solidity memory-safe-assembly |
| 708 | assembly { |
| 709 | mstore(0x00, m0) |
| 710 | mstore(0x20, m1) |
| 711 | mstore(0x40, m2) |
| 712 | mstore(0x60, m3) |
| 713 | } |
| 714 | } |
| 715 | |
| 716 | function log(address p0, address p1, uint256 p2) internal pure { |
| 717 | bytes32 m0; |
| 718 | bytes32 m1; |
| 719 | bytes32 m2; |
| 720 | bytes32 m3; |
| 721 | /// @solidity memory-safe-assembly |
| 722 | assembly { |
| 723 | m0 := mload(0x00) |
| 724 | m1 := mload(0x20) |
| 725 | m2 := mload(0x40) |
| 726 | m3 := mload(0x60) |
| 727 | // Selector of `log(address,address,uint256)`. |
| 728 | mstore(0x00, 0x17fe6185) |
| 729 | mstore(0x20, p0) |
| 730 | mstore(0x40, p1) |
| 731 | mstore(0x60, p2) |
| 732 | } |
| 733 | _sendLogPayload(0x1c, 0x64); |
| 734 | /// @solidity memory-safe-assembly |
| 735 | assembly { |
| 736 | mstore(0x00, m0) |
| 737 | mstore(0x20, m1) |
| 738 | mstore(0x40, m2) |
| 739 | mstore(0x60, m3) |
| 740 | } |
| 741 | } |
| 742 | |
| 743 | function log(address p0, address p1, bytes32 p2) internal pure { |
| 744 | bytes32 m0; |
| 745 | bytes32 m1; |
| 746 | bytes32 m2; |
| 747 | bytes32 m3; |
| 748 | bytes32 m4; |
| 749 | bytes32 m5; |
| 750 | /// @solidity memory-safe-assembly |
| 751 | assembly { |
| 752 | function writeString(pos, w) { |
| 753 | let length := 0 |
| 754 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 755 | mstore(pos, length) |
| 756 | let shift := sub(256, shl(3, length)) |
| 757 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 758 | } |
| 759 | m0 := mload(0x00) |
| 760 | m1 := mload(0x20) |
| 761 | m2 := mload(0x40) |
| 762 | m3 := mload(0x60) |
| 763 | m4 := mload(0x80) |
| 764 | m5 := mload(0xa0) |
| 765 | // Selector of `log(address,address,string)`. |
| 766 | mstore(0x00, 0x007150be) |
| 767 | mstore(0x20, p0) |
| 768 | mstore(0x40, p1) |
| 769 | mstore(0x60, 0x60) |
| 770 | writeString(0x80, p2) |
| 771 | } |
| 772 | _sendLogPayload(0x1c, 0xa4); |
| 773 | /// @solidity memory-safe-assembly |
| 774 | assembly { |
| 775 | mstore(0x00, m0) |
| 776 | mstore(0x20, m1) |
| 777 | mstore(0x40, m2) |
| 778 | mstore(0x60, m3) |
| 779 | mstore(0x80, m4) |
| 780 | mstore(0xa0, m5) |
| 781 | } |
| 782 | } |
| 783 | |
| 784 | function log(address p0, bool p1, address p2) internal pure { |
| 785 | bytes32 m0; |
| 786 | bytes32 m1; |
| 787 | bytes32 m2; |
| 788 | bytes32 m3; |
| 789 | /// @solidity memory-safe-assembly |
| 790 | assembly { |
| 791 | m0 := mload(0x00) |
| 792 | m1 := mload(0x20) |
| 793 | m2 := mload(0x40) |
| 794 | m3 := mload(0x60) |
| 795 | // Selector of `log(address,bool,address)`. |
| 796 | mstore(0x00, 0xf11699ed) |
| 797 | mstore(0x20, p0) |
| 798 | mstore(0x40, p1) |
| 799 | mstore(0x60, p2) |
| 800 | } |
| 801 | _sendLogPayload(0x1c, 0x64); |
| 802 | /// @solidity memory-safe-assembly |
| 803 | assembly { |
| 804 | mstore(0x00, m0) |
| 805 | mstore(0x20, m1) |
| 806 | mstore(0x40, m2) |
| 807 | mstore(0x60, m3) |
| 808 | } |
| 809 | } |
| 810 | |
| 811 | function log(address p0, bool p1, bool p2) internal pure { |
| 812 | bytes32 m0; |
| 813 | bytes32 m1; |
| 814 | bytes32 m2; |
| 815 | bytes32 m3; |
| 816 | /// @solidity memory-safe-assembly |
| 817 | assembly { |
| 818 | m0 := mload(0x00) |
| 819 | m1 := mload(0x20) |
| 820 | m2 := mload(0x40) |
| 821 | m3 := mload(0x60) |
| 822 | // Selector of `log(address,bool,bool)`. |
| 823 | mstore(0x00, 0xeb830c92) |
| 824 | mstore(0x20, p0) |
| 825 | mstore(0x40, p1) |
| 826 | mstore(0x60, p2) |
| 827 | } |
| 828 | _sendLogPayload(0x1c, 0x64); |
| 829 | /// @solidity memory-safe-assembly |
| 830 | assembly { |
| 831 | mstore(0x00, m0) |
| 832 | mstore(0x20, m1) |
| 833 | mstore(0x40, m2) |
| 834 | mstore(0x60, m3) |
| 835 | } |
| 836 | } |
| 837 | |
| 838 | function log(address p0, bool p1, uint256 p2) internal pure { |
| 839 | bytes32 m0; |
| 840 | bytes32 m1; |
| 841 | bytes32 m2; |
| 842 | bytes32 m3; |
| 843 | /// @solidity memory-safe-assembly |
| 844 | assembly { |
| 845 | m0 := mload(0x00) |
| 846 | m1 := mload(0x20) |
| 847 | m2 := mload(0x40) |
| 848 | m3 := mload(0x60) |
| 849 | // Selector of `log(address,bool,uint256)`. |
| 850 | mstore(0x00, 0x9c4f99fb) |
| 851 | mstore(0x20, p0) |
| 852 | mstore(0x40, p1) |
| 853 | mstore(0x60, p2) |
| 854 | } |
| 855 | _sendLogPayload(0x1c, 0x64); |
| 856 | /// @solidity memory-safe-assembly |
| 857 | assembly { |
| 858 | mstore(0x00, m0) |
| 859 | mstore(0x20, m1) |
| 860 | mstore(0x40, m2) |
| 861 | mstore(0x60, m3) |
| 862 | } |
| 863 | } |
| 864 | |
| 865 | function log(address p0, bool p1, bytes32 p2) internal pure { |
| 866 | bytes32 m0; |
| 867 | bytes32 m1; |
| 868 | bytes32 m2; |
| 869 | bytes32 m3; |
| 870 | bytes32 m4; |
| 871 | bytes32 m5; |
| 872 | /// @solidity memory-safe-assembly |
| 873 | assembly { |
| 874 | function writeString(pos, w) { |
| 875 | let length := 0 |
| 876 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 877 | mstore(pos, length) |
| 878 | let shift := sub(256, shl(3, length)) |
| 879 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 880 | } |
| 881 | m0 := mload(0x00) |
| 882 | m1 := mload(0x20) |
| 883 | m2 := mload(0x40) |
| 884 | m3 := mload(0x60) |
| 885 | m4 := mload(0x80) |
| 886 | m5 := mload(0xa0) |
| 887 | // Selector of `log(address,bool,string)`. |
| 888 | mstore(0x00, 0x212255cc) |
| 889 | mstore(0x20, p0) |
| 890 | mstore(0x40, p1) |
| 891 | mstore(0x60, 0x60) |
| 892 | writeString(0x80, p2) |
| 893 | } |
| 894 | _sendLogPayload(0x1c, 0xa4); |
| 895 | /// @solidity memory-safe-assembly |
| 896 | assembly { |
| 897 | mstore(0x00, m0) |
| 898 | mstore(0x20, m1) |
| 899 | mstore(0x40, m2) |
| 900 | mstore(0x60, m3) |
| 901 | mstore(0x80, m4) |
| 902 | mstore(0xa0, m5) |
| 903 | } |
| 904 | } |
| 905 | |
| 906 | function log(address p0, uint256 p1, address p2) internal pure { |
| 907 | bytes32 m0; |
| 908 | bytes32 m1; |
| 909 | bytes32 m2; |
| 910 | bytes32 m3; |
| 911 | /// @solidity memory-safe-assembly |
| 912 | assembly { |
| 913 | m0 := mload(0x00) |
| 914 | m1 := mload(0x20) |
| 915 | m2 := mload(0x40) |
| 916 | m3 := mload(0x60) |
| 917 | // Selector of `log(address,uint256,address)`. |
| 918 | mstore(0x00, 0x7bc0d848) |
| 919 | mstore(0x20, p0) |
| 920 | mstore(0x40, p1) |
| 921 | mstore(0x60, p2) |
| 922 | } |
| 923 | _sendLogPayload(0x1c, 0x64); |
| 924 | /// @solidity memory-safe-assembly |
| 925 | assembly { |
| 926 | mstore(0x00, m0) |
| 927 | mstore(0x20, m1) |
| 928 | mstore(0x40, m2) |
| 929 | mstore(0x60, m3) |
| 930 | } |
| 931 | } |
| 932 | |
| 933 | function log(address p0, uint256 p1, bool p2) internal pure { |
| 934 | bytes32 m0; |
| 935 | bytes32 m1; |
| 936 | bytes32 m2; |
| 937 | bytes32 m3; |
| 938 | /// @solidity memory-safe-assembly |
| 939 | assembly { |
| 940 | m0 := mload(0x00) |
| 941 | m1 := mload(0x20) |
| 942 | m2 := mload(0x40) |
| 943 | m3 := mload(0x60) |
| 944 | // Selector of `log(address,uint256,bool)`. |
| 945 | mstore(0x00, 0x678209a8) |
| 946 | mstore(0x20, p0) |
| 947 | mstore(0x40, p1) |
| 948 | mstore(0x60, p2) |
| 949 | } |
| 950 | _sendLogPayload(0x1c, 0x64); |
| 951 | /// @solidity memory-safe-assembly |
| 952 | assembly { |
| 953 | mstore(0x00, m0) |
| 954 | mstore(0x20, m1) |
| 955 | mstore(0x40, m2) |
| 956 | mstore(0x60, m3) |
| 957 | } |
| 958 | } |
| 959 | |
| 960 | function log(address p0, uint256 p1, uint256 p2) internal pure { |
| 961 | bytes32 m0; |
| 962 | bytes32 m1; |
| 963 | bytes32 m2; |
| 964 | bytes32 m3; |
| 965 | /// @solidity memory-safe-assembly |
| 966 | assembly { |
| 967 | m0 := mload(0x00) |
| 968 | m1 := mload(0x20) |
| 969 | m2 := mload(0x40) |
| 970 | m3 := mload(0x60) |
| 971 | // Selector of `log(address,uint256,uint256)`. |
| 972 | mstore(0x00, 0xb69bcaf6) |
| 973 | mstore(0x20, p0) |
| 974 | mstore(0x40, p1) |
| 975 | mstore(0x60, p2) |
| 976 | } |
| 977 | _sendLogPayload(0x1c, 0x64); |
| 978 | /// @solidity memory-safe-assembly |
| 979 | assembly { |
| 980 | mstore(0x00, m0) |
| 981 | mstore(0x20, m1) |
| 982 | mstore(0x40, m2) |
| 983 | mstore(0x60, m3) |
| 984 | } |
| 985 | } |
| 986 | |
| 987 | function log(address p0, uint256 p1, bytes32 p2) internal pure { |
| 988 | bytes32 m0; |
| 989 | bytes32 m1; |
| 990 | bytes32 m2; |
| 991 | bytes32 m3; |
| 992 | bytes32 m4; |
| 993 | bytes32 m5; |
| 994 | /// @solidity memory-safe-assembly |
| 995 | assembly { |
| 996 | function writeString(pos, w) { |
| 997 | let length := 0 |
| 998 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 999 | mstore(pos, length) |
| 1000 | let shift := sub(256, shl(3, length)) |
| 1001 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 1002 | } |
| 1003 | m0 := mload(0x00) |
| 1004 | m1 := mload(0x20) |
| 1005 | m2 := mload(0x40) |
| 1006 | m3 := mload(0x60) |
| 1007 | m4 := mload(0x80) |
| 1008 | m5 := mload(0xa0) |
| 1009 | // Selector of `log(address,uint256,string)`. |
| 1010 | mstore(0x00, 0xa1f2e8aa) |
| 1011 | mstore(0x20, p0) |
| 1012 | mstore(0x40, p1) |
| 1013 | mstore(0x60, 0x60) |
| 1014 | writeString(0x80, p2) |
| 1015 | } |
| 1016 | _sendLogPayload(0x1c, 0xa4); |
| 1017 | /// @solidity memory-safe-assembly |
| 1018 | assembly { |
| 1019 | mstore(0x00, m0) |
| 1020 | mstore(0x20, m1) |
| 1021 | mstore(0x40, m2) |
| 1022 | mstore(0x60, m3) |
| 1023 | mstore(0x80, m4) |
| 1024 | mstore(0xa0, m5) |
| 1025 | } |
| 1026 | } |
| 1027 | |
| 1028 | function log(address p0, bytes32 p1, address p2) internal pure { |
| 1029 | bytes32 m0; |
| 1030 | bytes32 m1; |
| 1031 | bytes32 m2; |
| 1032 | bytes32 m3; |
| 1033 | bytes32 m4; |
| 1034 | bytes32 m5; |
| 1035 | /// @solidity memory-safe-assembly |
| 1036 | assembly { |
| 1037 | function writeString(pos, w) { |
| 1038 | let length := 0 |
| 1039 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 1040 | mstore(pos, length) |
| 1041 | let shift := sub(256, shl(3, length)) |
| 1042 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 1043 | } |
| 1044 | m0 := mload(0x00) |
| 1045 | m1 := mload(0x20) |
| 1046 | m2 := mload(0x40) |
| 1047 | m3 := mload(0x60) |
| 1048 | m4 := mload(0x80) |
| 1049 | m5 := mload(0xa0) |
| 1050 | // Selector of `log(address,string,address)`. |
| 1051 | mstore(0x00, 0xf08744e8) |
| 1052 | mstore(0x20, p0) |
| 1053 | mstore(0x40, 0x60) |
| 1054 | mstore(0x60, p2) |
| 1055 | writeString(0x80, p1) |
| 1056 | } |
| 1057 | _sendLogPayload(0x1c, 0xa4); |
| 1058 | /// @solidity memory-safe-assembly |
| 1059 | assembly { |
| 1060 | mstore(0x00, m0) |
| 1061 | mstore(0x20, m1) |
| 1062 | mstore(0x40, m2) |
| 1063 | mstore(0x60, m3) |
| 1064 | mstore(0x80, m4) |
| 1065 | mstore(0xa0, m5) |
| 1066 | } |
| 1067 | } |
| 1068 | |
| 1069 | function log(address p0, bytes32 p1, bool p2) internal pure { |
| 1070 | bytes32 m0; |
| 1071 | bytes32 m1; |
| 1072 | bytes32 m2; |
| 1073 | bytes32 m3; |
| 1074 | bytes32 m4; |
| 1075 | bytes32 m5; |
| 1076 | /// @solidity memory-safe-assembly |
| 1077 | assembly { |
| 1078 | function writeString(pos, w) { |
| 1079 | let length := 0 |
| 1080 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 1081 | mstore(pos, length) |
| 1082 | let shift := sub(256, shl(3, length)) |
| 1083 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 1084 | } |
| 1085 | m0 := mload(0x00) |
| 1086 | m1 := mload(0x20) |
| 1087 | m2 := mload(0x40) |
| 1088 | m3 := mload(0x60) |
| 1089 | m4 := mload(0x80) |
| 1090 | m5 := mload(0xa0) |
| 1091 | // Selector of `log(address,string,bool)`. |
| 1092 | mstore(0x00, 0xcf020fb1) |
| 1093 | mstore(0x20, p0) |
| 1094 | mstore(0x40, 0x60) |
| 1095 | mstore(0x60, p2) |
| 1096 | writeString(0x80, p1) |
| 1097 | } |
| 1098 | _sendLogPayload(0x1c, 0xa4); |
| 1099 | /// @solidity memory-safe-assembly |
| 1100 | assembly { |
| 1101 | mstore(0x00, m0) |
| 1102 | mstore(0x20, m1) |
| 1103 | mstore(0x40, m2) |
| 1104 | mstore(0x60, m3) |
| 1105 | mstore(0x80, m4) |
| 1106 | mstore(0xa0, m5) |
| 1107 | } |
| 1108 | } |
| 1109 | |
| 1110 | function log(address p0, bytes32 p1, uint256 p2) internal pure { |
| 1111 | bytes32 m0; |
| 1112 | bytes32 m1; |
| 1113 | bytes32 m2; |
| 1114 | bytes32 m3; |
| 1115 | bytes32 m4; |
| 1116 | bytes32 m5; |
| 1117 | /// @solidity memory-safe-assembly |
| 1118 | assembly { |
| 1119 | function writeString(pos, w) { |
| 1120 | let length := 0 |
| 1121 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 1122 | mstore(pos, length) |
| 1123 | let shift := sub(256, shl(3, length)) |
| 1124 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 1125 | } |
| 1126 | m0 := mload(0x00) |
| 1127 | m1 := mload(0x20) |
| 1128 | m2 := mload(0x40) |
| 1129 | m3 := mload(0x60) |
| 1130 | m4 := mload(0x80) |
| 1131 | m5 := mload(0xa0) |
| 1132 | // Selector of `log(address,string,uint256)`. |
| 1133 | mstore(0x00, 0x67dd6ff1) |
| 1134 | mstore(0x20, p0) |
| 1135 | mstore(0x40, 0x60) |
| 1136 | mstore(0x60, p2) |
| 1137 | writeString(0x80, p1) |
| 1138 | } |
| 1139 | _sendLogPayload(0x1c, 0xa4); |
| 1140 | /// @solidity memory-safe-assembly |
| 1141 | assembly { |
| 1142 | mstore(0x00, m0) |
| 1143 | mstore(0x20, m1) |
| 1144 | mstore(0x40, m2) |
| 1145 | mstore(0x60, m3) |
| 1146 | mstore(0x80, m4) |
| 1147 | mstore(0xa0, m5) |
| 1148 | } |
| 1149 | } |
| 1150 | |
| 1151 | function log(address p0, bytes32 p1, bytes32 p2) internal pure { |
| 1152 | bytes32 m0; |
| 1153 | bytes32 m1; |
| 1154 | bytes32 m2; |
| 1155 | bytes32 m3; |
| 1156 | bytes32 m4; |
| 1157 | bytes32 m5; |
| 1158 | bytes32 m6; |
| 1159 | bytes32 m7; |
| 1160 | /// @solidity memory-safe-assembly |
| 1161 | assembly { |
| 1162 | function writeString(pos, w) { |
| 1163 | let length := 0 |
| 1164 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 1165 | mstore(pos, length) |
| 1166 | let shift := sub(256, shl(3, length)) |
| 1167 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 1168 | } |
| 1169 | m0 := mload(0x00) |
| 1170 | m1 := mload(0x20) |
| 1171 | m2 := mload(0x40) |
| 1172 | m3 := mload(0x60) |
| 1173 | m4 := mload(0x80) |
| 1174 | m5 := mload(0xa0) |
| 1175 | m6 := mload(0xc0) |
| 1176 | m7 := mload(0xe0) |
| 1177 | // Selector of `log(address,string,string)`. |
| 1178 | mstore(0x00, 0xfb772265) |
| 1179 | mstore(0x20, p0) |
| 1180 | mstore(0x40, 0x60) |
| 1181 | mstore(0x60, 0xa0) |
| 1182 | writeString(0x80, p1) |
| 1183 | writeString(0xc0, p2) |
| 1184 | } |
| 1185 | _sendLogPayload(0x1c, 0xe4); |
| 1186 | /// @solidity memory-safe-assembly |
| 1187 | assembly { |
| 1188 | mstore(0x00, m0) |
| 1189 | mstore(0x20, m1) |
| 1190 | mstore(0x40, m2) |
| 1191 | mstore(0x60, m3) |
| 1192 | mstore(0x80, m4) |
| 1193 | mstore(0xa0, m5) |
| 1194 | mstore(0xc0, m6) |
| 1195 | mstore(0xe0, m7) |
| 1196 | } |
| 1197 | } |
| 1198 | |
| 1199 | function log(bool p0, address p1, address p2) internal pure { |
| 1200 | bytes32 m0; |
| 1201 | bytes32 m1; |
| 1202 | bytes32 m2; |
| 1203 | bytes32 m3; |
| 1204 | /// @solidity memory-safe-assembly |
| 1205 | assembly { |
| 1206 | m0 := mload(0x00) |
| 1207 | m1 := mload(0x20) |
| 1208 | m2 := mload(0x40) |
| 1209 | m3 := mload(0x60) |
| 1210 | // Selector of `log(bool,address,address)`. |
| 1211 | mstore(0x00, 0xd2763667) |
| 1212 | mstore(0x20, p0) |
| 1213 | mstore(0x40, p1) |
| 1214 | mstore(0x60, p2) |
| 1215 | } |
| 1216 | _sendLogPayload(0x1c, 0x64); |
| 1217 | /// @solidity memory-safe-assembly |
| 1218 | assembly { |
| 1219 | mstore(0x00, m0) |
| 1220 | mstore(0x20, m1) |
| 1221 | mstore(0x40, m2) |
| 1222 | mstore(0x60, m3) |
| 1223 | } |
| 1224 | } |
| 1225 | |
| 1226 | function log(bool p0, address p1, bool p2) internal pure { |
| 1227 | bytes32 m0; |
| 1228 | bytes32 m1; |
| 1229 | bytes32 m2; |
| 1230 | bytes32 m3; |
| 1231 | /// @solidity memory-safe-assembly |
| 1232 | assembly { |
| 1233 | m0 := mload(0x00) |
| 1234 | m1 := mload(0x20) |
| 1235 | m2 := mload(0x40) |
| 1236 | m3 := mload(0x60) |
| 1237 | // Selector of `log(bool,address,bool)`. |
| 1238 | mstore(0x00, 0x18c9c746) |
| 1239 | mstore(0x20, p0) |
| 1240 | mstore(0x40, p1) |
| 1241 | mstore(0x60, p2) |
| 1242 | } |
| 1243 | _sendLogPayload(0x1c, 0x64); |
| 1244 | /// @solidity memory-safe-assembly |
| 1245 | assembly { |
| 1246 | mstore(0x00, m0) |
| 1247 | mstore(0x20, m1) |
| 1248 | mstore(0x40, m2) |
| 1249 | mstore(0x60, m3) |
| 1250 | } |
| 1251 | } |
| 1252 | |
| 1253 | function log(bool p0, address p1, uint256 p2) internal pure { |
| 1254 | bytes32 m0; |
| 1255 | bytes32 m1; |
| 1256 | bytes32 m2; |
| 1257 | bytes32 m3; |
| 1258 | /// @solidity memory-safe-assembly |
| 1259 | assembly { |
| 1260 | m0 := mload(0x00) |
| 1261 | m1 := mload(0x20) |
| 1262 | m2 := mload(0x40) |
| 1263 | m3 := mload(0x60) |
| 1264 | // Selector of `log(bool,address,uint256)`. |
| 1265 | mstore(0x00, 0x5f7b9afb) |
| 1266 | mstore(0x20, p0) |
| 1267 | mstore(0x40, p1) |
| 1268 | mstore(0x60, p2) |
| 1269 | } |
| 1270 | _sendLogPayload(0x1c, 0x64); |
| 1271 | /// @solidity memory-safe-assembly |
| 1272 | assembly { |
| 1273 | mstore(0x00, m0) |
| 1274 | mstore(0x20, m1) |
| 1275 | mstore(0x40, m2) |
| 1276 | mstore(0x60, m3) |
| 1277 | } |
| 1278 | } |
| 1279 | |
| 1280 | function log(bool p0, address p1, bytes32 p2) internal pure { |
| 1281 | bytes32 m0; |
| 1282 | bytes32 m1; |
| 1283 | bytes32 m2; |
| 1284 | bytes32 m3; |
| 1285 | bytes32 m4; |
| 1286 | bytes32 m5; |
| 1287 | /// @solidity memory-safe-assembly |
| 1288 | assembly { |
| 1289 | function writeString(pos, w) { |
| 1290 | let length := 0 |
| 1291 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 1292 | mstore(pos, length) |
| 1293 | let shift := sub(256, shl(3, length)) |
| 1294 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 1295 | } |
| 1296 | m0 := mload(0x00) |
| 1297 | m1 := mload(0x20) |
| 1298 | m2 := mload(0x40) |
| 1299 | m3 := mload(0x60) |
| 1300 | m4 := mload(0x80) |
| 1301 | m5 := mload(0xa0) |
| 1302 | // Selector of `log(bool,address,string)`. |
| 1303 | mstore(0x00, 0xde9a9270) |
| 1304 | mstore(0x20, p0) |
| 1305 | mstore(0x40, p1) |
| 1306 | mstore(0x60, 0x60) |
| 1307 | writeString(0x80, p2) |
| 1308 | } |
| 1309 | _sendLogPayload(0x1c, 0xa4); |
| 1310 | /// @solidity memory-safe-assembly |
| 1311 | assembly { |
| 1312 | mstore(0x00, m0) |
| 1313 | mstore(0x20, m1) |
| 1314 | mstore(0x40, m2) |
| 1315 | mstore(0x60, m3) |
| 1316 | mstore(0x80, m4) |
| 1317 | mstore(0xa0, m5) |
| 1318 | } |
| 1319 | } |
| 1320 | |
| 1321 | function log(bool p0, bool p1, address p2) internal pure { |
| 1322 | bytes32 m0; |
| 1323 | bytes32 m1; |
| 1324 | bytes32 m2; |
| 1325 | bytes32 m3; |
| 1326 | /// @solidity memory-safe-assembly |
| 1327 | assembly { |
| 1328 | m0 := mload(0x00) |
| 1329 | m1 := mload(0x20) |
| 1330 | m2 := mload(0x40) |
| 1331 | m3 := mload(0x60) |
| 1332 | // Selector of `log(bool,bool,address)`. |
| 1333 | mstore(0x00, 0x1078f68d) |
| 1334 | mstore(0x20, p0) |
| 1335 | mstore(0x40, p1) |
| 1336 | mstore(0x60, p2) |
| 1337 | } |
| 1338 | _sendLogPayload(0x1c, 0x64); |
| 1339 | /// @solidity memory-safe-assembly |
| 1340 | assembly { |
| 1341 | mstore(0x00, m0) |
| 1342 | mstore(0x20, m1) |
| 1343 | mstore(0x40, m2) |
| 1344 | mstore(0x60, m3) |
| 1345 | } |
| 1346 | } |
| 1347 | |
| 1348 | function log(bool p0, bool p1, bool p2) internal pure { |
| 1349 | bytes32 m0; |
| 1350 | bytes32 m1; |
| 1351 | bytes32 m2; |
| 1352 | bytes32 m3; |
| 1353 | /// @solidity memory-safe-assembly |
| 1354 | assembly { |
| 1355 | m0 := mload(0x00) |
| 1356 | m1 := mload(0x20) |
| 1357 | m2 := mload(0x40) |
| 1358 | m3 := mload(0x60) |
| 1359 | // Selector of `log(bool,bool,bool)`. |
| 1360 | mstore(0x00, 0x50709698) |
| 1361 | mstore(0x20, p0) |
| 1362 | mstore(0x40, p1) |
| 1363 | mstore(0x60, p2) |
| 1364 | } |
| 1365 | _sendLogPayload(0x1c, 0x64); |
| 1366 | /// @solidity memory-safe-assembly |
| 1367 | assembly { |
| 1368 | mstore(0x00, m0) |
| 1369 | mstore(0x20, m1) |
| 1370 | mstore(0x40, m2) |
| 1371 | mstore(0x60, m3) |
| 1372 | } |
| 1373 | } |
| 1374 | |
| 1375 | function log(bool p0, bool p1, uint256 p2) internal pure { |
| 1376 | bytes32 m0; |
| 1377 | bytes32 m1; |
| 1378 | bytes32 m2; |
| 1379 | bytes32 m3; |
| 1380 | /// @solidity memory-safe-assembly |
| 1381 | assembly { |
| 1382 | m0 := mload(0x00) |
| 1383 | m1 := mload(0x20) |
| 1384 | m2 := mload(0x40) |
| 1385 | m3 := mload(0x60) |
| 1386 | // Selector of `log(bool,bool,uint256)`. |
| 1387 | mstore(0x00, 0x12f21602) |
| 1388 | mstore(0x20, p0) |
| 1389 | mstore(0x40, p1) |
| 1390 | mstore(0x60, p2) |
| 1391 | } |
| 1392 | _sendLogPayload(0x1c, 0x64); |
| 1393 | /// @solidity memory-safe-assembly |
| 1394 | assembly { |
| 1395 | mstore(0x00, m0) |
| 1396 | mstore(0x20, m1) |
| 1397 | mstore(0x40, m2) |
| 1398 | mstore(0x60, m3) |
| 1399 | } |
| 1400 | } |
| 1401 | |
| 1402 | function log(bool p0, bool p1, bytes32 p2) internal pure { |
| 1403 | bytes32 m0; |
| 1404 | bytes32 m1; |
| 1405 | bytes32 m2; |
| 1406 | bytes32 m3; |
| 1407 | bytes32 m4; |
| 1408 | bytes32 m5; |
| 1409 | /// @solidity memory-safe-assembly |
| 1410 | assembly { |
| 1411 | function writeString(pos, w) { |
| 1412 | let length := 0 |
| 1413 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 1414 | mstore(pos, length) |
| 1415 | let shift := sub(256, shl(3, length)) |
| 1416 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 1417 | } |
| 1418 | m0 := mload(0x00) |
| 1419 | m1 := mload(0x20) |
| 1420 | m2 := mload(0x40) |
| 1421 | m3 := mload(0x60) |
| 1422 | m4 := mload(0x80) |
| 1423 | m5 := mload(0xa0) |
| 1424 | // Selector of `log(bool,bool,string)`. |
| 1425 | mstore(0x00, 0x2555fa46) |
| 1426 | mstore(0x20, p0) |
| 1427 | mstore(0x40, p1) |
| 1428 | mstore(0x60, 0x60) |
| 1429 | writeString(0x80, p2) |
| 1430 | } |
| 1431 | _sendLogPayload(0x1c, 0xa4); |
| 1432 | /// @solidity memory-safe-assembly |
| 1433 | assembly { |
| 1434 | mstore(0x00, m0) |
| 1435 | mstore(0x20, m1) |
| 1436 | mstore(0x40, m2) |
| 1437 | mstore(0x60, m3) |
| 1438 | mstore(0x80, m4) |
| 1439 | mstore(0xa0, m5) |
| 1440 | } |
| 1441 | } |
| 1442 | |
| 1443 | function log(bool p0, uint256 p1, address p2) internal pure { |
| 1444 | bytes32 m0; |
| 1445 | bytes32 m1; |
| 1446 | bytes32 m2; |
| 1447 | bytes32 m3; |
| 1448 | /// @solidity memory-safe-assembly |
| 1449 | assembly { |
| 1450 | m0 := mload(0x00) |
| 1451 | m1 := mload(0x20) |
| 1452 | m2 := mload(0x40) |
| 1453 | m3 := mload(0x60) |
| 1454 | // Selector of `log(bool,uint256,address)`. |
| 1455 | mstore(0x00, 0x088ef9d2) |
| 1456 | mstore(0x20, p0) |
| 1457 | mstore(0x40, p1) |
| 1458 | mstore(0x60, p2) |
| 1459 | } |
| 1460 | _sendLogPayload(0x1c, 0x64); |
| 1461 | /// @solidity memory-safe-assembly |
| 1462 | assembly { |
| 1463 | mstore(0x00, m0) |
| 1464 | mstore(0x20, m1) |
| 1465 | mstore(0x40, m2) |
| 1466 | mstore(0x60, m3) |
| 1467 | } |
| 1468 | } |
| 1469 | |
| 1470 | function log(bool p0, uint256 p1, bool p2) internal pure { |
| 1471 | bytes32 m0; |
| 1472 | bytes32 m1; |
| 1473 | bytes32 m2; |
| 1474 | bytes32 m3; |
| 1475 | /// @solidity memory-safe-assembly |
| 1476 | assembly { |
| 1477 | m0 := mload(0x00) |
| 1478 | m1 := mload(0x20) |
| 1479 | m2 := mload(0x40) |
| 1480 | m3 := mload(0x60) |
| 1481 | // Selector of `log(bool,uint256,bool)`. |
| 1482 | mstore(0x00, 0xe8defba9) |
| 1483 | mstore(0x20, p0) |
| 1484 | mstore(0x40, p1) |
| 1485 | mstore(0x60, p2) |
| 1486 | } |
| 1487 | _sendLogPayload(0x1c, 0x64); |
| 1488 | /// @solidity memory-safe-assembly |
| 1489 | assembly { |
| 1490 | mstore(0x00, m0) |
| 1491 | mstore(0x20, m1) |
| 1492 | mstore(0x40, m2) |
| 1493 | mstore(0x60, m3) |
| 1494 | } |
| 1495 | } |
| 1496 | |
| 1497 | function log(bool p0, uint256 p1, uint256 p2) internal pure { |
| 1498 | bytes32 m0; |
| 1499 | bytes32 m1; |
| 1500 | bytes32 m2; |
| 1501 | bytes32 m3; |
| 1502 | /// @solidity memory-safe-assembly |
| 1503 | assembly { |
| 1504 | m0 := mload(0x00) |
| 1505 | m1 := mload(0x20) |
| 1506 | m2 := mload(0x40) |
| 1507 | m3 := mload(0x60) |
| 1508 | // Selector of `log(bool,uint256,uint256)`. |
| 1509 | mstore(0x00, 0x37103367) |
| 1510 | mstore(0x20, p0) |
| 1511 | mstore(0x40, p1) |
| 1512 | mstore(0x60, p2) |
| 1513 | } |
| 1514 | _sendLogPayload(0x1c, 0x64); |
| 1515 | /// @solidity memory-safe-assembly |
| 1516 | assembly { |
| 1517 | mstore(0x00, m0) |
| 1518 | mstore(0x20, m1) |
| 1519 | mstore(0x40, m2) |
| 1520 | mstore(0x60, m3) |
| 1521 | } |
| 1522 | } |
| 1523 | |
| 1524 | function log(bool p0, uint256 p1, bytes32 p2) internal pure { |
| 1525 | bytes32 m0; |
| 1526 | bytes32 m1; |
| 1527 | bytes32 m2; |
| 1528 | bytes32 m3; |
| 1529 | bytes32 m4; |
| 1530 | bytes32 m5; |
| 1531 | /// @solidity memory-safe-assembly |
| 1532 | assembly { |
| 1533 | function writeString(pos, w) { |
| 1534 | let length := 0 |
| 1535 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 1536 | mstore(pos, length) |
| 1537 | let shift := sub(256, shl(3, length)) |
| 1538 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 1539 | } |
| 1540 | m0 := mload(0x00) |
| 1541 | m1 := mload(0x20) |
| 1542 | m2 := mload(0x40) |
| 1543 | m3 := mload(0x60) |
| 1544 | m4 := mload(0x80) |
| 1545 | m5 := mload(0xa0) |
| 1546 | // Selector of `log(bool,uint256,string)`. |
| 1547 | mstore(0x00, 0xc3fc3970) |
| 1548 | mstore(0x20, p0) |
| 1549 | mstore(0x40, p1) |
| 1550 | mstore(0x60, 0x60) |
| 1551 | writeString(0x80, p2) |
| 1552 | } |
| 1553 | _sendLogPayload(0x1c, 0xa4); |
| 1554 | /// @solidity memory-safe-assembly |
| 1555 | assembly { |
| 1556 | mstore(0x00, m0) |
| 1557 | mstore(0x20, m1) |
| 1558 | mstore(0x40, m2) |
| 1559 | mstore(0x60, m3) |
| 1560 | mstore(0x80, m4) |
| 1561 | mstore(0xa0, m5) |
| 1562 | } |
| 1563 | } |
| 1564 | |
| 1565 | function log(bool p0, bytes32 p1, address p2) internal pure { |
| 1566 | bytes32 m0; |
| 1567 | bytes32 m1; |
| 1568 | bytes32 m2; |
| 1569 | bytes32 m3; |
| 1570 | bytes32 m4; |
| 1571 | bytes32 m5; |
| 1572 | /// @solidity memory-safe-assembly |
| 1573 | assembly { |
| 1574 | function writeString(pos, w) { |
| 1575 | let length := 0 |
| 1576 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 1577 | mstore(pos, length) |
| 1578 | let shift := sub(256, shl(3, length)) |
| 1579 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 1580 | } |
| 1581 | m0 := mload(0x00) |
| 1582 | m1 := mload(0x20) |
| 1583 | m2 := mload(0x40) |
| 1584 | m3 := mload(0x60) |
| 1585 | m4 := mload(0x80) |
| 1586 | m5 := mload(0xa0) |
| 1587 | // Selector of `log(bool,string,address)`. |
| 1588 | mstore(0x00, 0x9591b953) |
| 1589 | mstore(0x20, p0) |
| 1590 | mstore(0x40, 0x60) |
| 1591 | mstore(0x60, p2) |
| 1592 | writeString(0x80, p1) |
| 1593 | } |
| 1594 | _sendLogPayload(0x1c, 0xa4); |
| 1595 | /// @solidity memory-safe-assembly |
| 1596 | assembly { |
| 1597 | mstore(0x00, m0) |
| 1598 | mstore(0x20, m1) |
| 1599 | mstore(0x40, m2) |
| 1600 | mstore(0x60, m3) |
| 1601 | mstore(0x80, m4) |
| 1602 | mstore(0xa0, m5) |
| 1603 | } |
| 1604 | } |
| 1605 | |
| 1606 | function log(bool p0, bytes32 p1, bool p2) internal pure { |
| 1607 | bytes32 m0; |
| 1608 | bytes32 m1; |
| 1609 | bytes32 m2; |
| 1610 | bytes32 m3; |
| 1611 | bytes32 m4; |
| 1612 | bytes32 m5; |
| 1613 | /// @solidity memory-safe-assembly |
| 1614 | assembly { |
| 1615 | function writeString(pos, w) { |
| 1616 | let length := 0 |
| 1617 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 1618 | mstore(pos, length) |
| 1619 | let shift := sub(256, shl(3, length)) |
| 1620 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 1621 | } |
| 1622 | m0 := mload(0x00) |
| 1623 | m1 := mload(0x20) |
| 1624 | m2 := mload(0x40) |
| 1625 | m3 := mload(0x60) |
| 1626 | m4 := mload(0x80) |
| 1627 | m5 := mload(0xa0) |
| 1628 | // Selector of `log(bool,string,bool)`. |
| 1629 | mstore(0x00, 0xdbb4c247) |
| 1630 | mstore(0x20, p0) |
| 1631 | mstore(0x40, 0x60) |
| 1632 | mstore(0x60, p2) |
| 1633 | writeString(0x80, p1) |
| 1634 | } |
| 1635 | _sendLogPayload(0x1c, 0xa4); |
| 1636 | /// @solidity memory-safe-assembly |
| 1637 | assembly { |
| 1638 | mstore(0x00, m0) |
| 1639 | mstore(0x20, m1) |
| 1640 | mstore(0x40, m2) |
| 1641 | mstore(0x60, m3) |
| 1642 | mstore(0x80, m4) |
| 1643 | mstore(0xa0, m5) |
| 1644 | } |
| 1645 | } |
| 1646 | |
| 1647 | function log(bool p0, bytes32 p1, uint256 p2) internal pure { |
| 1648 | bytes32 m0; |
| 1649 | bytes32 m1; |
| 1650 | bytes32 m2; |
| 1651 | bytes32 m3; |
| 1652 | bytes32 m4; |
| 1653 | bytes32 m5; |
| 1654 | /// @solidity memory-safe-assembly |
| 1655 | assembly { |
| 1656 | function writeString(pos, w) { |
| 1657 | let length := 0 |
| 1658 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 1659 | mstore(pos, length) |
| 1660 | let shift := sub(256, shl(3, length)) |
| 1661 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 1662 | } |
| 1663 | m0 := mload(0x00) |
| 1664 | m1 := mload(0x20) |
| 1665 | m2 := mload(0x40) |
| 1666 | m3 := mload(0x60) |
| 1667 | m4 := mload(0x80) |
| 1668 | m5 := mload(0xa0) |
| 1669 | // Selector of `log(bool,string,uint256)`. |
| 1670 | mstore(0x00, 0x1093ee11) |
| 1671 | mstore(0x20, p0) |
| 1672 | mstore(0x40, 0x60) |
| 1673 | mstore(0x60, p2) |
| 1674 | writeString(0x80, p1) |
| 1675 | } |
| 1676 | _sendLogPayload(0x1c, 0xa4); |
| 1677 | /// @solidity memory-safe-assembly |
| 1678 | assembly { |
| 1679 | mstore(0x00, m0) |
| 1680 | mstore(0x20, m1) |
| 1681 | mstore(0x40, m2) |
| 1682 | mstore(0x60, m3) |
| 1683 | mstore(0x80, m4) |
| 1684 | mstore(0xa0, m5) |
| 1685 | } |
| 1686 | } |
| 1687 | |
| 1688 | function log(bool p0, bytes32 p1, bytes32 p2) internal pure { |
| 1689 | bytes32 m0; |
| 1690 | bytes32 m1; |
| 1691 | bytes32 m2; |
| 1692 | bytes32 m3; |
| 1693 | bytes32 m4; |
| 1694 | bytes32 m5; |
| 1695 | bytes32 m6; |
| 1696 | bytes32 m7; |
| 1697 | /// @solidity memory-safe-assembly |
| 1698 | assembly { |
| 1699 | function writeString(pos, w) { |
| 1700 | let length := 0 |
| 1701 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 1702 | mstore(pos, length) |
| 1703 | let shift := sub(256, shl(3, length)) |
| 1704 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 1705 | } |
| 1706 | m0 := mload(0x00) |
| 1707 | m1 := mload(0x20) |
| 1708 | m2 := mload(0x40) |
| 1709 | m3 := mload(0x60) |
| 1710 | m4 := mload(0x80) |
| 1711 | m5 := mload(0xa0) |
| 1712 | m6 := mload(0xc0) |
| 1713 | m7 := mload(0xe0) |
| 1714 | // Selector of `log(bool,string,string)`. |
| 1715 | mstore(0x00, 0xb076847f) |
| 1716 | mstore(0x20, p0) |
| 1717 | mstore(0x40, 0x60) |
| 1718 | mstore(0x60, 0xa0) |
| 1719 | writeString(0x80, p1) |
| 1720 | writeString(0xc0, p2) |
| 1721 | } |
| 1722 | _sendLogPayload(0x1c, 0xe4); |
| 1723 | /// @solidity memory-safe-assembly |
| 1724 | assembly { |
| 1725 | mstore(0x00, m0) |
| 1726 | mstore(0x20, m1) |
| 1727 | mstore(0x40, m2) |
| 1728 | mstore(0x60, m3) |
| 1729 | mstore(0x80, m4) |
| 1730 | mstore(0xa0, m5) |
| 1731 | mstore(0xc0, m6) |
| 1732 | mstore(0xe0, m7) |
| 1733 | } |
| 1734 | } |
| 1735 | |
| 1736 | function log(uint256 p0, address p1, address p2) internal pure { |
| 1737 | bytes32 m0; |
| 1738 | bytes32 m1; |
| 1739 | bytes32 m2; |
| 1740 | bytes32 m3; |
| 1741 | /// @solidity memory-safe-assembly |
| 1742 | assembly { |
| 1743 | m0 := mload(0x00) |
| 1744 | m1 := mload(0x20) |
| 1745 | m2 := mload(0x40) |
| 1746 | m3 := mload(0x60) |
| 1747 | // Selector of `log(uint256,address,address)`. |
| 1748 | mstore(0x00, 0xbcfd9be0) |
| 1749 | mstore(0x20, p0) |
| 1750 | mstore(0x40, p1) |
| 1751 | mstore(0x60, p2) |
| 1752 | } |
| 1753 | _sendLogPayload(0x1c, 0x64); |
| 1754 | /// @solidity memory-safe-assembly |
| 1755 | assembly { |
| 1756 | mstore(0x00, m0) |
| 1757 | mstore(0x20, m1) |
| 1758 | mstore(0x40, m2) |
| 1759 | mstore(0x60, m3) |
| 1760 | } |
| 1761 | } |
| 1762 | |
| 1763 | function log(uint256 p0, address p1, bool p2) internal pure { |
| 1764 | bytes32 m0; |
| 1765 | bytes32 m1; |
| 1766 | bytes32 m2; |
| 1767 | bytes32 m3; |
| 1768 | /// @solidity memory-safe-assembly |
| 1769 | assembly { |
| 1770 | m0 := mload(0x00) |
| 1771 | m1 := mload(0x20) |
| 1772 | m2 := mload(0x40) |
| 1773 | m3 := mload(0x60) |
| 1774 | // Selector of `log(uint256,address,bool)`. |
| 1775 | mstore(0x00, 0x9b6ec042) |
| 1776 | mstore(0x20, p0) |
| 1777 | mstore(0x40, p1) |
| 1778 | mstore(0x60, p2) |
| 1779 | } |
| 1780 | _sendLogPayload(0x1c, 0x64); |
| 1781 | /// @solidity memory-safe-assembly |
| 1782 | assembly { |
| 1783 | mstore(0x00, m0) |
| 1784 | mstore(0x20, m1) |
| 1785 | mstore(0x40, m2) |
| 1786 | mstore(0x60, m3) |
| 1787 | } |
| 1788 | } |
| 1789 | |
| 1790 | function log(uint256 p0, address p1, uint256 p2) internal pure { |
| 1791 | bytes32 m0; |
| 1792 | bytes32 m1; |
| 1793 | bytes32 m2; |
| 1794 | bytes32 m3; |
| 1795 | /// @solidity memory-safe-assembly |
| 1796 | assembly { |
| 1797 | m0 := mload(0x00) |
| 1798 | m1 := mload(0x20) |
| 1799 | m2 := mload(0x40) |
| 1800 | m3 := mload(0x60) |
| 1801 | // Selector of `log(uint256,address,uint256)`. |
| 1802 | mstore(0x00, 0x5a9b5ed5) |
| 1803 | mstore(0x20, p0) |
| 1804 | mstore(0x40, p1) |
| 1805 | mstore(0x60, p2) |
| 1806 | } |
| 1807 | _sendLogPayload(0x1c, 0x64); |
| 1808 | /// @solidity memory-safe-assembly |
| 1809 | assembly { |
| 1810 | mstore(0x00, m0) |
| 1811 | mstore(0x20, m1) |
| 1812 | mstore(0x40, m2) |
| 1813 | mstore(0x60, m3) |
| 1814 | } |
| 1815 | } |
| 1816 | |
| 1817 | function log(uint256 p0, address p1, bytes32 p2) internal pure { |
| 1818 | bytes32 m0; |
| 1819 | bytes32 m1; |
| 1820 | bytes32 m2; |
| 1821 | bytes32 m3; |
| 1822 | bytes32 m4; |
| 1823 | bytes32 m5; |
| 1824 | /// @solidity memory-safe-assembly |
| 1825 | assembly { |
| 1826 | function writeString(pos, w) { |
| 1827 | let length := 0 |
| 1828 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 1829 | mstore(pos, length) |
| 1830 | let shift := sub(256, shl(3, length)) |
| 1831 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 1832 | } |
| 1833 | m0 := mload(0x00) |
| 1834 | m1 := mload(0x20) |
| 1835 | m2 := mload(0x40) |
| 1836 | m3 := mload(0x60) |
| 1837 | m4 := mload(0x80) |
| 1838 | m5 := mload(0xa0) |
| 1839 | // Selector of `log(uint256,address,string)`. |
| 1840 | mstore(0x00, 0x63cb41f9) |
| 1841 | mstore(0x20, p0) |
| 1842 | mstore(0x40, p1) |
| 1843 | mstore(0x60, 0x60) |
| 1844 | writeString(0x80, p2) |
| 1845 | } |
| 1846 | _sendLogPayload(0x1c, 0xa4); |
| 1847 | /// @solidity memory-safe-assembly |
| 1848 | assembly { |
| 1849 | mstore(0x00, m0) |
| 1850 | mstore(0x20, m1) |
| 1851 | mstore(0x40, m2) |
| 1852 | mstore(0x60, m3) |
| 1853 | mstore(0x80, m4) |
| 1854 | mstore(0xa0, m5) |
| 1855 | } |
| 1856 | } |
| 1857 | |
| 1858 | function log(uint256 p0, bool p1, address p2) internal pure { |
| 1859 | bytes32 m0; |
| 1860 | bytes32 m1; |
| 1861 | bytes32 m2; |
| 1862 | bytes32 m3; |
| 1863 | /// @solidity memory-safe-assembly |
| 1864 | assembly { |
| 1865 | m0 := mload(0x00) |
| 1866 | m1 := mload(0x20) |
| 1867 | m2 := mload(0x40) |
| 1868 | m3 := mload(0x60) |
| 1869 | // Selector of `log(uint256,bool,address)`. |
| 1870 | mstore(0x00, 0x35085f7b) |
| 1871 | mstore(0x20, p0) |
| 1872 | mstore(0x40, p1) |
| 1873 | mstore(0x60, p2) |
| 1874 | } |
| 1875 | _sendLogPayload(0x1c, 0x64); |
| 1876 | /// @solidity memory-safe-assembly |
| 1877 | assembly { |
| 1878 | mstore(0x00, m0) |
| 1879 | mstore(0x20, m1) |
| 1880 | mstore(0x40, m2) |
| 1881 | mstore(0x60, m3) |
| 1882 | } |
| 1883 | } |
| 1884 | |
| 1885 | function log(uint256 p0, bool p1, bool p2) internal pure { |
| 1886 | bytes32 m0; |
| 1887 | bytes32 m1; |
| 1888 | bytes32 m2; |
| 1889 | bytes32 m3; |
| 1890 | /// @solidity memory-safe-assembly |
| 1891 | assembly { |
| 1892 | m0 := mload(0x00) |
| 1893 | m1 := mload(0x20) |
| 1894 | m2 := mload(0x40) |
| 1895 | m3 := mload(0x60) |
| 1896 | // Selector of `log(uint256,bool,bool)`. |
| 1897 | mstore(0x00, 0x20718650) |
| 1898 | mstore(0x20, p0) |
| 1899 | mstore(0x40, p1) |
| 1900 | mstore(0x60, p2) |
| 1901 | } |
| 1902 | _sendLogPayload(0x1c, 0x64); |
| 1903 | /// @solidity memory-safe-assembly |
| 1904 | assembly { |
| 1905 | mstore(0x00, m0) |
| 1906 | mstore(0x20, m1) |
| 1907 | mstore(0x40, m2) |
| 1908 | mstore(0x60, m3) |
| 1909 | } |
| 1910 | } |
| 1911 | |
| 1912 | function log(uint256 p0, bool p1, uint256 p2) internal pure { |
| 1913 | bytes32 m0; |
| 1914 | bytes32 m1; |
| 1915 | bytes32 m2; |
| 1916 | bytes32 m3; |
| 1917 | /// @solidity memory-safe-assembly |
| 1918 | assembly { |
| 1919 | m0 := mload(0x00) |
| 1920 | m1 := mload(0x20) |
| 1921 | m2 := mload(0x40) |
| 1922 | m3 := mload(0x60) |
| 1923 | // Selector of `log(uint256,bool,uint256)`. |
| 1924 | mstore(0x00, 0x20098014) |
| 1925 | mstore(0x20, p0) |
| 1926 | mstore(0x40, p1) |
| 1927 | mstore(0x60, p2) |
| 1928 | } |
| 1929 | _sendLogPayload(0x1c, 0x64); |
| 1930 | /// @solidity memory-safe-assembly |
| 1931 | assembly { |
| 1932 | mstore(0x00, m0) |
| 1933 | mstore(0x20, m1) |
| 1934 | mstore(0x40, m2) |
| 1935 | mstore(0x60, m3) |
| 1936 | } |
| 1937 | } |
| 1938 | |
| 1939 | function log(uint256 p0, bool p1, bytes32 p2) internal pure { |
| 1940 | bytes32 m0; |
| 1941 | bytes32 m1; |
| 1942 | bytes32 m2; |
| 1943 | bytes32 m3; |
| 1944 | bytes32 m4; |
| 1945 | bytes32 m5; |
| 1946 | /// @solidity memory-safe-assembly |
| 1947 | assembly { |
| 1948 | function writeString(pos, w) { |
| 1949 | let length := 0 |
| 1950 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 1951 | mstore(pos, length) |
| 1952 | let shift := sub(256, shl(3, length)) |
| 1953 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 1954 | } |
| 1955 | m0 := mload(0x00) |
| 1956 | m1 := mload(0x20) |
| 1957 | m2 := mload(0x40) |
| 1958 | m3 := mload(0x60) |
| 1959 | m4 := mload(0x80) |
| 1960 | m5 := mload(0xa0) |
| 1961 | // Selector of `log(uint256,bool,string)`. |
| 1962 | mstore(0x00, 0x85775021) |
| 1963 | mstore(0x20, p0) |
| 1964 | mstore(0x40, p1) |
| 1965 | mstore(0x60, 0x60) |
| 1966 | writeString(0x80, p2) |
| 1967 | } |
| 1968 | _sendLogPayload(0x1c, 0xa4); |
| 1969 | /// @solidity memory-safe-assembly |
| 1970 | assembly { |
| 1971 | mstore(0x00, m0) |
| 1972 | mstore(0x20, m1) |
| 1973 | mstore(0x40, m2) |
| 1974 | mstore(0x60, m3) |
| 1975 | mstore(0x80, m4) |
| 1976 | mstore(0xa0, m5) |
| 1977 | } |
| 1978 | } |
| 1979 | |
| 1980 | function log(uint256 p0, uint256 p1, address p2) internal pure { |
| 1981 | bytes32 m0; |
| 1982 | bytes32 m1; |
| 1983 | bytes32 m2; |
| 1984 | bytes32 m3; |
| 1985 | /// @solidity memory-safe-assembly |
| 1986 | assembly { |
| 1987 | m0 := mload(0x00) |
| 1988 | m1 := mload(0x20) |
| 1989 | m2 := mload(0x40) |
| 1990 | m3 := mload(0x60) |
| 1991 | // Selector of `log(uint256,uint256,address)`. |
| 1992 | mstore(0x00, 0x5c96b331) |
| 1993 | mstore(0x20, p0) |
| 1994 | mstore(0x40, p1) |
| 1995 | mstore(0x60, p2) |
| 1996 | } |
| 1997 | _sendLogPayload(0x1c, 0x64); |
| 1998 | /// @solidity memory-safe-assembly |
| 1999 | assembly { |
| 2000 | mstore(0x00, m0) |
| 2001 | mstore(0x20, m1) |
| 2002 | mstore(0x40, m2) |
| 2003 | mstore(0x60, m3) |
| 2004 | } |
| 2005 | } |
| 2006 | |
| 2007 | function log(uint256 p0, uint256 p1, bool p2) internal pure { |
| 2008 | bytes32 m0; |
| 2009 | bytes32 m1; |
| 2010 | bytes32 m2; |
| 2011 | bytes32 m3; |
| 2012 | /// @solidity memory-safe-assembly |
| 2013 | assembly { |
| 2014 | m0 := mload(0x00) |
| 2015 | m1 := mload(0x20) |
| 2016 | m2 := mload(0x40) |
| 2017 | m3 := mload(0x60) |
| 2018 | // Selector of `log(uint256,uint256,bool)`. |
| 2019 | mstore(0x00, 0x4766da72) |
| 2020 | mstore(0x20, p0) |
| 2021 | mstore(0x40, p1) |
| 2022 | mstore(0x60, p2) |
| 2023 | } |
| 2024 | _sendLogPayload(0x1c, 0x64); |
| 2025 | /// @solidity memory-safe-assembly |
| 2026 | assembly { |
| 2027 | mstore(0x00, m0) |
| 2028 | mstore(0x20, m1) |
| 2029 | mstore(0x40, m2) |
| 2030 | mstore(0x60, m3) |
| 2031 | } |
| 2032 | } |
| 2033 | |
| 2034 | function log(uint256 p0, uint256 p1, uint256 p2) internal pure { |
| 2035 | bytes32 m0; |
| 2036 | bytes32 m1; |
| 2037 | bytes32 m2; |
| 2038 | bytes32 m3; |
| 2039 | /// @solidity memory-safe-assembly |
| 2040 | assembly { |
| 2041 | m0 := mload(0x00) |
| 2042 | m1 := mload(0x20) |
| 2043 | m2 := mload(0x40) |
| 2044 | m3 := mload(0x60) |
| 2045 | // Selector of `log(uint256,uint256,uint256)`. |
| 2046 | mstore(0x00, 0xd1ed7a3c) |
| 2047 | mstore(0x20, p0) |
| 2048 | mstore(0x40, p1) |
| 2049 | mstore(0x60, p2) |
| 2050 | } |
| 2051 | _sendLogPayload(0x1c, 0x64); |
| 2052 | /// @solidity memory-safe-assembly |
| 2053 | assembly { |
| 2054 | mstore(0x00, m0) |
| 2055 | mstore(0x20, m1) |
| 2056 | mstore(0x40, m2) |
| 2057 | mstore(0x60, m3) |
| 2058 | } |
| 2059 | } |
| 2060 | |
| 2061 | function log(uint256 p0, uint256 p1, bytes32 p2) internal pure { |
| 2062 | bytes32 m0; |
| 2063 | bytes32 m1; |
| 2064 | bytes32 m2; |
| 2065 | bytes32 m3; |
| 2066 | bytes32 m4; |
| 2067 | bytes32 m5; |
| 2068 | /// @solidity memory-safe-assembly |
| 2069 | assembly { |
| 2070 | function writeString(pos, w) { |
| 2071 | let length := 0 |
| 2072 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 2073 | mstore(pos, length) |
| 2074 | let shift := sub(256, shl(3, length)) |
| 2075 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 2076 | } |
| 2077 | m0 := mload(0x00) |
| 2078 | m1 := mload(0x20) |
| 2079 | m2 := mload(0x40) |
| 2080 | m3 := mload(0x60) |
| 2081 | m4 := mload(0x80) |
| 2082 | m5 := mload(0xa0) |
| 2083 | // Selector of `log(uint256,uint256,string)`. |
| 2084 | mstore(0x00, 0x71d04af2) |
| 2085 | mstore(0x20, p0) |
| 2086 | mstore(0x40, p1) |
| 2087 | mstore(0x60, 0x60) |
| 2088 | writeString(0x80, p2) |
| 2089 | } |
| 2090 | _sendLogPayload(0x1c, 0xa4); |
| 2091 | /// @solidity memory-safe-assembly |
| 2092 | assembly { |
| 2093 | mstore(0x00, m0) |
| 2094 | mstore(0x20, m1) |
| 2095 | mstore(0x40, m2) |
| 2096 | mstore(0x60, m3) |
| 2097 | mstore(0x80, m4) |
| 2098 | mstore(0xa0, m5) |
| 2099 | } |
| 2100 | } |
| 2101 | |
| 2102 | function log(uint256 p0, bytes32 p1, address p2) internal pure { |
| 2103 | bytes32 m0; |
| 2104 | bytes32 m1; |
| 2105 | bytes32 m2; |
| 2106 | bytes32 m3; |
| 2107 | bytes32 m4; |
| 2108 | bytes32 m5; |
| 2109 | /// @solidity memory-safe-assembly |
| 2110 | assembly { |
| 2111 | function writeString(pos, w) { |
| 2112 | let length := 0 |
| 2113 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 2114 | mstore(pos, length) |
| 2115 | let shift := sub(256, shl(3, length)) |
| 2116 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 2117 | } |
| 2118 | m0 := mload(0x00) |
| 2119 | m1 := mload(0x20) |
| 2120 | m2 := mload(0x40) |
| 2121 | m3 := mload(0x60) |
| 2122 | m4 := mload(0x80) |
| 2123 | m5 := mload(0xa0) |
| 2124 | // Selector of `log(uint256,string,address)`. |
| 2125 | mstore(0x00, 0x7afac959) |
| 2126 | mstore(0x20, p0) |
| 2127 | mstore(0x40, 0x60) |
| 2128 | mstore(0x60, p2) |
| 2129 | writeString(0x80, p1) |
| 2130 | } |
| 2131 | _sendLogPayload(0x1c, 0xa4); |
| 2132 | /// @solidity memory-safe-assembly |
| 2133 | assembly { |
| 2134 | mstore(0x00, m0) |
| 2135 | mstore(0x20, m1) |
| 2136 | mstore(0x40, m2) |
| 2137 | mstore(0x60, m3) |
| 2138 | mstore(0x80, m4) |
| 2139 | mstore(0xa0, m5) |
| 2140 | } |
| 2141 | } |
| 2142 | |
| 2143 | function log(uint256 p0, bytes32 p1, bool p2) internal pure { |
| 2144 | bytes32 m0; |
| 2145 | bytes32 m1; |
| 2146 | bytes32 m2; |
| 2147 | bytes32 m3; |
| 2148 | bytes32 m4; |
| 2149 | bytes32 m5; |
| 2150 | /// @solidity memory-safe-assembly |
| 2151 | assembly { |
| 2152 | function writeString(pos, w) { |
| 2153 | let length := 0 |
| 2154 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 2155 | mstore(pos, length) |
| 2156 | let shift := sub(256, shl(3, length)) |
| 2157 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 2158 | } |
| 2159 | m0 := mload(0x00) |
| 2160 | m1 := mload(0x20) |
| 2161 | m2 := mload(0x40) |
| 2162 | m3 := mload(0x60) |
| 2163 | m4 := mload(0x80) |
| 2164 | m5 := mload(0xa0) |
| 2165 | // Selector of `log(uint256,string,bool)`. |
| 2166 | mstore(0x00, 0x4ceda75a) |
| 2167 | mstore(0x20, p0) |
| 2168 | mstore(0x40, 0x60) |
| 2169 | mstore(0x60, p2) |
| 2170 | writeString(0x80, p1) |
| 2171 | } |
| 2172 | _sendLogPayload(0x1c, 0xa4); |
| 2173 | /// @solidity memory-safe-assembly |
| 2174 | assembly { |
| 2175 | mstore(0x00, m0) |
| 2176 | mstore(0x20, m1) |
| 2177 | mstore(0x40, m2) |
| 2178 | mstore(0x60, m3) |
| 2179 | mstore(0x80, m4) |
| 2180 | mstore(0xa0, m5) |
| 2181 | } |
| 2182 | } |
| 2183 | |
| 2184 | function log(uint256 p0, bytes32 p1, uint256 p2) internal pure { |
| 2185 | bytes32 m0; |
| 2186 | bytes32 m1; |
| 2187 | bytes32 m2; |
| 2188 | bytes32 m3; |
| 2189 | bytes32 m4; |
| 2190 | bytes32 m5; |
| 2191 | /// @solidity memory-safe-assembly |
| 2192 | assembly { |
| 2193 | function writeString(pos, w) { |
| 2194 | let length := 0 |
| 2195 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 2196 | mstore(pos, length) |
| 2197 | let shift := sub(256, shl(3, length)) |
| 2198 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 2199 | } |
| 2200 | m0 := mload(0x00) |
| 2201 | m1 := mload(0x20) |
| 2202 | m2 := mload(0x40) |
| 2203 | m3 := mload(0x60) |
| 2204 | m4 := mload(0x80) |
| 2205 | m5 := mload(0xa0) |
| 2206 | // Selector of `log(uint256,string,uint256)`. |
| 2207 | mstore(0x00, 0x37aa7d4c) |
| 2208 | mstore(0x20, p0) |
| 2209 | mstore(0x40, 0x60) |
| 2210 | mstore(0x60, p2) |
| 2211 | writeString(0x80, p1) |
| 2212 | } |
| 2213 | _sendLogPayload(0x1c, 0xa4); |
| 2214 | /// @solidity memory-safe-assembly |
| 2215 | assembly { |
| 2216 | mstore(0x00, m0) |
| 2217 | mstore(0x20, m1) |
| 2218 | mstore(0x40, m2) |
| 2219 | mstore(0x60, m3) |
| 2220 | mstore(0x80, m4) |
| 2221 | mstore(0xa0, m5) |
| 2222 | } |
| 2223 | } |
| 2224 | |
| 2225 | function log(uint256 p0, bytes32 p1, bytes32 p2) internal pure { |
| 2226 | bytes32 m0; |
| 2227 | bytes32 m1; |
| 2228 | bytes32 m2; |
| 2229 | bytes32 m3; |
| 2230 | bytes32 m4; |
| 2231 | bytes32 m5; |
| 2232 | bytes32 m6; |
| 2233 | bytes32 m7; |
| 2234 | /// @solidity memory-safe-assembly |
| 2235 | assembly { |
| 2236 | function writeString(pos, w) { |
| 2237 | let length := 0 |
| 2238 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 2239 | mstore(pos, length) |
| 2240 | let shift := sub(256, shl(3, length)) |
| 2241 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 2242 | } |
| 2243 | m0 := mload(0x00) |
| 2244 | m1 := mload(0x20) |
| 2245 | m2 := mload(0x40) |
| 2246 | m3 := mload(0x60) |
| 2247 | m4 := mload(0x80) |
| 2248 | m5 := mload(0xa0) |
| 2249 | m6 := mload(0xc0) |
| 2250 | m7 := mload(0xe0) |
| 2251 | // Selector of `log(uint256,string,string)`. |
| 2252 | mstore(0x00, 0xb115611f) |
| 2253 | mstore(0x20, p0) |
| 2254 | mstore(0x40, 0x60) |
| 2255 | mstore(0x60, 0xa0) |
| 2256 | writeString(0x80, p1) |
| 2257 | writeString(0xc0, p2) |
| 2258 | } |
| 2259 | _sendLogPayload(0x1c, 0xe4); |
| 2260 | /// @solidity memory-safe-assembly |
| 2261 | assembly { |
| 2262 | mstore(0x00, m0) |
| 2263 | mstore(0x20, m1) |
| 2264 | mstore(0x40, m2) |
| 2265 | mstore(0x60, m3) |
| 2266 | mstore(0x80, m4) |
| 2267 | mstore(0xa0, m5) |
| 2268 | mstore(0xc0, m6) |
| 2269 | mstore(0xe0, m7) |
| 2270 | } |
| 2271 | } |
| 2272 | |
| 2273 | function log(bytes32 p0, address p1, address p2) internal pure { |
| 2274 | bytes32 m0; |
| 2275 | bytes32 m1; |
| 2276 | bytes32 m2; |
| 2277 | bytes32 m3; |
| 2278 | bytes32 m4; |
| 2279 | bytes32 m5; |
| 2280 | /// @solidity memory-safe-assembly |
| 2281 | assembly { |
| 2282 | function writeString(pos, w) { |
| 2283 | let length := 0 |
| 2284 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 2285 | mstore(pos, length) |
| 2286 | let shift := sub(256, shl(3, length)) |
| 2287 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 2288 | } |
| 2289 | m0 := mload(0x00) |
| 2290 | m1 := mload(0x20) |
| 2291 | m2 := mload(0x40) |
| 2292 | m3 := mload(0x60) |
| 2293 | m4 := mload(0x80) |
| 2294 | m5 := mload(0xa0) |
| 2295 | // Selector of `log(string,address,address)`. |
| 2296 | mstore(0x00, 0xfcec75e0) |
| 2297 | mstore(0x20, 0x60) |
| 2298 | mstore(0x40, p1) |
| 2299 | mstore(0x60, p2) |
| 2300 | writeString(0x80, p0) |
| 2301 | } |
| 2302 | _sendLogPayload(0x1c, 0xa4); |
| 2303 | /// @solidity memory-safe-assembly |
| 2304 | assembly { |
| 2305 | mstore(0x00, m0) |
| 2306 | mstore(0x20, m1) |
| 2307 | mstore(0x40, m2) |
| 2308 | mstore(0x60, m3) |
| 2309 | mstore(0x80, m4) |
| 2310 | mstore(0xa0, m5) |
| 2311 | } |
| 2312 | } |
| 2313 | |
| 2314 | function log(bytes32 p0, address p1, bool p2) internal pure { |
| 2315 | bytes32 m0; |
| 2316 | bytes32 m1; |
| 2317 | bytes32 m2; |
| 2318 | bytes32 m3; |
| 2319 | bytes32 m4; |
| 2320 | bytes32 m5; |
| 2321 | /// @solidity memory-safe-assembly |
| 2322 | assembly { |
| 2323 | function writeString(pos, w) { |
| 2324 | let length := 0 |
| 2325 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 2326 | mstore(pos, length) |
| 2327 | let shift := sub(256, shl(3, length)) |
| 2328 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 2329 | } |
| 2330 | m0 := mload(0x00) |
| 2331 | m1 := mload(0x20) |
| 2332 | m2 := mload(0x40) |
| 2333 | m3 := mload(0x60) |
| 2334 | m4 := mload(0x80) |
| 2335 | m5 := mload(0xa0) |
| 2336 | // Selector of `log(string,address,bool)`. |
| 2337 | mstore(0x00, 0xc91d5ed4) |
| 2338 | mstore(0x20, 0x60) |
| 2339 | mstore(0x40, p1) |
| 2340 | mstore(0x60, p2) |
| 2341 | writeString(0x80, p0) |
| 2342 | } |
| 2343 | _sendLogPayload(0x1c, 0xa4); |
| 2344 | /// @solidity memory-safe-assembly |
| 2345 | assembly { |
| 2346 | mstore(0x00, m0) |
| 2347 | mstore(0x20, m1) |
| 2348 | mstore(0x40, m2) |
| 2349 | mstore(0x60, m3) |
| 2350 | mstore(0x80, m4) |
| 2351 | mstore(0xa0, m5) |
| 2352 | } |
| 2353 | } |
| 2354 | |
| 2355 | function log(bytes32 p0, address p1, uint256 p2) internal pure { |
| 2356 | bytes32 m0; |
| 2357 | bytes32 m1; |
| 2358 | bytes32 m2; |
| 2359 | bytes32 m3; |
| 2360 | bytes32 m4; |
| 2361 | bytes32 m5; |
| 2362 | /// @solidity memory-safe-assembly |
| 2363 | assembly { |
| 2364 | function writeString(pos, w) { |
| 2365 | let length := 0 |
| 2366 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 2367 | mstore(pos, length) |
| 2368 | let shift := sub(256, shl(3, length)) |
| 2369 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 2370 | } |
| 2371 | m0 := mload(0x00) |
| 2372 | m1 := mload(0x20) |
| 2373 | m2 := mload(0x40) |
| 2374 | m3 := mload(0x60) |
| 2375 | m4 := mload(0x80) |
| 2376 | m5 := mload(0xa0) |
| 2377 | // Selector of `log(string,address,uint256)`. |
| 2378 | mstore(0x00, 0x0d26b925) |
| 2379 | mstore(0x20, 0x60) |
| 2380 | mstore(0x40, p1) |
| 2381 | mstore(0x60, p2) |
| 2382 | writeString(0x80, p0) |
| 2383 | } |
| 2384 | _sendLogPayload(0x1c, 0xa4); |
| 2385 | /// @solidity memory-safe-assembly |
| 2386 | assembly { |
| 2387 | mstore(0x00, m0) |
| 2388 | mstore(0x20, m1) |
| 2389 | mstore(0x40, m2) |
| 2390 | mstore(0x60, m3) |
| 2391 | mstore(0x80, m4) |
| 2392 | mstore(0xa0, m5) |
| 2393 | } |
| 2394 | } |
| 2395 | |
| 2396 | function log(bytes32 p0, address p1, bytes32 p2) internal pure { |
| 2397 | bytes32 m0; |
| 2398 | bytes32 m1; |
| 2399 | bytes32 m2; |
| 2400 | bytes32 m3; |
| 2401 | bytes32 m4; |
| 2402 | bytes32 m5; |
| 2403 | bytes32 m6; |
| 2404 | bytes32 m7; |
| 2405 | /// @solidity memory-safe-assembly |
| 2406 | assembly { |
| 2407 | function writeString(pos, w) { |
| 2408 | let length := 0 |
| 2409 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 2410 | mstore(pos, length) |
| 2411 | let shift := sub(256, shl(3, length)) |
| 2412 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 2413 | } |
| 2414 | m0 := mload(0x00) |
| 2415 | m1 := mload(0x20) |
| 2416 | m2 := mload(0x40) |
| 2417 | m3 := mload(0x60) |
| 2418 | m4 := mload(0x80) |
| 2419 | m5 := mload(0xa0) |
| 2420 | m6 := mload(0xc0) |
| 2421 | m7 := mload(0xe0) |
| 2422 | // Selector of `log(string,address,string)`. |
| 2423 | mstore(0x00, 0xe0e9ad4f) |
| 2424 | mstore(0x20, 0x60) |
| 2425 | mstore(0x40, p1) |
| 2426 | mstore(0x60, 0xa0) |
| 2427 | writeString(0x80, p0) |
| 2428 | writeString(0xc0, p2) |
| 2429 | } |
| 2430 | _sendLogPayload(0x1c, 0xe4); |
| 2431 | /// @solidity memory-safe-assembly |
| 2432 | assembly { |
| 2433 | mstore(0x00, m0) |
| 2434 | mstore(0x20, m1) |
| 2435 | mstore(0x40, m2) |
| 2436 | mstore(0x60, m3) |
| 2437 | mstore(0x80, m4) |
| 2438 | mstore(0xa0, m5) |
| 2439 | mstore(0xc0, m6) |
| 2440 | mstore(0xe0, m7) |
| 2441 | } |
| 2442 | } |
| 2443 | |
| 2444 | function log(bytes32 p0, bool p1, address p2) internal pure { |
| 2445 | bytes32 m0; |
| 2446 | bytes32 m1; |
| 2447 | bytes32 m2; |
| 2448 | bytes32 m3; |
| 2449 | bytes32 m4; |
| 2450 | bytes32 m5; |
| 2451 | /// @solidity memory-safe-assembly |
| 2452 | assembly { |
| 2453 | function writeString(pos, w) { |
| 2454 | let length := 0 |
| 2455 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 2456 | mstore(pos, length) |
| 2457 | let shift := sub(256, shl(3, length)) |
| 2458 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 2459 | } |
| 2460 | m0 := mload(0x00) |
| 2461 | m1 := mload(0x20) |
| 2462 | m2 := mload(0x40) |
| 2463 | m3 := mload(0x60) |
| 2464 | m4 := mload(0x80) |
| 2465 | m5 := mload(0xa0) |
| 2466 | // Selector of `log(string,bool,address)`. |
| 2467 | mstore(0x00, 0x932bbb38) |
| 2468 | mstore(0x20, 0x60) |
| 2469 | mstore(0x40, p1) |
| 2470 | mstore(0x60, p2) |
| 2471 | writeString(0x80, p0) |
| 2472 | } |
| 2473 | _sendLogPayload(0x1c, 0xa4); |
| 2474 | /// @solidity memory-safe-assembly |
| 2475 | assembly { |
| 2476 | mstore(0x00, m0) |
| 2477 | mstore(0x20, m1) |
| 2478 | mstore(0x40, m2) |
| 2479 | mstore(0x60, m3) |
| 2480 | mstore(0x80, m4) |
| 2481 | mstore(0xa0, m5) |
| 2482 | } |
| 2483 | } |
| 2484 | |
| 2485 | function log(bytes32 p0, bool p1, bool p2) internal pure { |
| 2486 | bytes32 m0; |
| 2487 | bytes32 m1; |
| 2488 | bytes32 m2; |
| 2489 | bytes32 m3; |
| 2490 | bytes32 m4; |
| 2491 | bytes32 m5; |
| 2492 | /// @solidity memory-safe-assembly |
| 2493 | assembly { |
| 2494 | function writeString(pos, w) { |
| 2495 | let length := 0 |
| 2496 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 2497 | mstore(pos, length) |
| 2498 | let shift := sub(256, shl(3, length)) |
| 2499 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 2500 | } |
| 2501 | m0 := mload(0x00) |
| 2502 | m1 := mload(0x20) |
| 2503 | m2 := mload(0x40) |
| 2504 | m3 := mload(0x60) |
| 2505 | m4 := mload(0x80) |
| 2506 | m5 := mload(0xa0) |
| 2507 | // Selector of `log(string,bool,bool)`. |
| 2508 | mstore(0x00, 0x850b7ad6) |
| 2509 | mstore(0x20, 0x60) |
| 2510 | mstore(0x40, p1) |
| 2511 | mstore(0x60, p2) |
| 2512 | writeString(0x80, p0) |
| 2513 | } |
| 2514 | _sendLogPayload(0x1c, 0xa4); |
| 2515 | /// @solidity memory-safe-assembly |
| 2516 | assembly { |
| 2517 | mstore(0x00, m0) |
| 2518 | mstore(0x20, m1) |
| 2519 | mstore(0x40, m2) |
| 2520 | mstore(0x60, m3) |
| 2521 | mstore(0x80, m4) |
| 2522 | mstore(0xa0, m5) |
| 2523 | } |
| 2524 | } |
| 2525 | |
| 2526 | function log(bytes32 p0, bool p1, uint256 p2) internal pure { |
| 2527 | bytes32 m0; |
| 2528 | bytes32 m1; |
| 2529 | bytes32 m2; |
| 2530 | bytes32 m3; |
| 2531 | bytes32 m4; |
| 2532 | bytes32 m5; |
| 2533 | /// @solidity memory-safe-assembly |
| 2534 | assembly { |
| 2535 | function writeString(pos, w) { |
| 2536 | let length := 0 |
| 2537 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 2538 | mstore(pos, length) |
| 2539 | let shift := sub(256, shl(3, length)) |
| 2540 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 2541 | } |
| 2542 | m0 := mload(0x00) |
| 2543 | m1 := mload(0x20) |
| 2544 | m2 := mload(0x40) |
| 2545 | m3 := mload(0x60) |
| 2546 | m4 := mload(0x80) |
| 2547 | m5 := mload(0xa0) |
| 2548 | // Selector of `log(string,bool,uint256)`. |
| 2549 | mstore(0x00, 0xc95958d6) |
| 2550 | mstore(0x20, 0x60) |
| 2551 | mstore(0x40, p1) |
| 2552 | mstore(0x60, p2) |
| 2553 | writeString(0x80, p0) |
| 2554 | } |
| 2555 | _sendLogPayload(0x1c, 0xa4); |
| 2556 | /// @solidity memory-safe-assembly |
| 2557 | assembly { |
| 2558 | mstore(0x00, m0) |
| 2559 | mstore(0x20, m1) |
| 2560 | mstore(0x40, m2) |
| 2561 | mstore(0x60, m3) |
| 2562 | mstore(0x80, m4) |
| 2563 | mstore(0xa0, m5) |
| 2564 | } |
| 2565 | } |
| 2566 | |
| 2567 | function log(bytes32 p0, bool p1, bytes32 p2) internal pure { |
| 2568 | bytes32 m0; |
| 2569 | bytes32 m1; |
| 2570 | bytes32 m2; |
| 2571 | bytes32 m3; |
| 2572 | bytes32 m4; |
| 2573 | bytes32 m5; |
| 2574 | bytes32 m6; |
| 2575 | bytes32 m7; |
| 2576 | /// @solidity memory-safe-assembly |
| 2577 | assembly { |
| 2578 | function writeString(pos, w) { |
| 2579 | let length := 0 |
| 2580 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 2581 | mstore(pos, length) |
| 2582 | let shift := sub(256, shl(3, length)) |
| 2583 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 2584 | } |
| 2585 | m0 := mload(0x00) |
| 2586 | m1 := mload(0x20) |
| 2587 | m2 := mload(0x40) |
| 2588 | m3 := mload(0x60) |
| 2589 | m4 := mload(0x80) |
| 2590 | m5 := mload(0xa0) |
| 2591 | m6 := mload(0xc0) |
| 2592 | m7 := mload(0xe0) |
| 2593 | // Selector of `log(string,bool,string)`. |
| 2594 | mstore(0x00, 0xe298f47d) |
| 2595 | mstore(0x20, 0x60) |
| 2596 | mstore(0x40, p1) |
| 2597 | mstore(0x60, 0xa0) |
| 2598 | writeString(0x80, p0) |
| 2599 | writeString(0xc0, p2) |
| 2600 | } |
| 2601 | _sendLogPayload(0x1c, 0xe4); |
| 2602 | /// @solidity memory-safe-assembly |
| 2603 | assembly { |
| 2604 | mstore(0x00, m0) |
| 2605 | mstore(0x20, m1) |
| 2606 | mstore(0x40, m2) |
| 2607 | mstore(0x60, m3) |
| 2608 | mstore(0x80, m4) |
| 2609 | mstore(0xa0, m5) |
| 2610 | mstore(0xc0, m6) |
| 2611 | mstore(0xe0, m7) |
| 2612 | } |
| 2613 | } |
| 2614 | |
| 2615 | function log(bytes32 p0, uint256 p1, address p2) internal pure { |
| 2616 | bytes32 m0; |
| 2617 | bytes32 m1; |
| 2618 | bytes32 m2; |
| 2619 | bytes32 m3; |
| 2620 | bytes32 m4; |
| 2621 | bytes32 m5; |
| 2622 | /// @solidity memory-safe-assembly |
| 2623 | assembly { |
| 2624 | function writeString(pos, w) { |
| 2625 | let length := 0 |
| 2626 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 2627 | mstore(pos, length) |
| 2628 | let shift := sub(256, shl(3, length)) |
| 2629 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 2630 | } |
| 2631 | m0 := mload(0x00) |
| 2632 | m1 := mload(0x20) |
| 2633 | m2 := mload(0x40) |
| 2634 | m3 := mload(0x60) |
| 2635 | m4 := mload(0x80) |
| 2636 | m5 := mload(0xa0) |
| 2637 | // Selector of `log(string,uint256,address)`. |
| 2638 | mstore(0x00, 0x1c7ec448) |
| 2639 | mstore(0x20, 0x60) |
| 2640 | mstore(0x40, p1) |
| 2641 | mstore(0x60, p2) |
| 2642 | writeString(0x80, p0) |
| 2643 | } |
| 2644 | _sendLogPayload(0x1c, 0xa4); |
| 2645 | /// @solidity memory-safe-assembly |
| 2646 | assembly { |
| 2647 | mstore(0x00, m0) |
| 2648 | mstore(0x20, m1) |
| 2649 | mstore(0x40, m2) |
| 2650 | mstore(0x60, m3) |
| 2651 | mstore(0x80, m4) |
| 2652 | mstore(0xa0, m5) |
| 2653 | } |
| 2654 | } |
| 2655 | |
| 2656 | function log(bytes32 p0, uint256 p1, bool p2) internal pure { |
| 2657 | bytes32 m0; |
| 2658 | bytes32 m1; |
| 2659 | bytes32 m2; |
| 2660 | bytes32 m3; |
| 2661 | bytes32 m4; |
| 2662 | bytes32 m5; |
| 2663 | /// @solidity memory-safe-assembly |
| 2664 | assembly { |
| 2665 | function writeString(pos, w) { |
| 2666 | let length := 0 |
| 2667 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 2668 | mstore(pos, length) |
| 2669 | let shift := sub(256, shl(3, length)) |
| 2670 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 2671 | } |
| 2672 | m0 := mload(0x00) |
| 2673 | m1 := mload(0x20) |
| 2674 | m2 := mload(0x40) |
| 2675 | m3 := mload(0x60) |
| 2676 | m4 := mload(0x80) |
| 2677 | m5 := mload(0xa0) |
| 2678 | // Selector of `log(string,uint256,bool)`. |
| 2679 | mstore(0x00, 0xca7733b1) |
| 2680 | mstore(0x20, 0x60) |
| 2681 | mstore(0x40, p1) |
| 2682 | mstore(0x60, p2) |
| 2683 | writeString(0x80, p0) |
| 2684 | } |
| 2685 | _sendLogPayload(0x1c, 0xa4); |
| 2686 | /// @solidity memory-safe-assembly |
| 2687 | assembly { |
| 2688 | mstore(0x00, m0) |
| 2689 | mstore(0x20, m1) |
| 2690 | mstore(0x40, m2) |
| 2691 | mstore(0x60, m3) |
| 2692 | mstore(0x80, m4) |
| 2693 | mstore(0xa0, m5) |
| 2694 | } |
| 2695 | } |
| 2696 | |
| 2697 | function log(bytes32 p0, uint256 p1, uint256 p2) internal pure { |
| 2698 | bytes32 m0; |
| 2699 | bytes32 m1; |
| 2700 | bytes32 m2; |
| 2701 | bytes32 m3; |
| 2702 | bytes32 m4; |
| 2703 | bytes32 m5; |
| 2704 | /// @solidity memory-safe-assembly |
| 2705 | assembly { |
| 2706 | function writeString(pos, w) { |
| 2707 | let length := 0 |
| 2708 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 2709 | mstore(pos, length) |
| 2710 | let shift := sub(256, shl(3, length)) |
| 2711 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 2712 | } |
| 2713 | m0 := mload(0x00) |
| 2714 | m1 := mload(0x20) |
| 2715 | m2 := mload(0x40) |
| 2716 | m3 := mload(0x60) |
| 2717 | m4 := mload(0x80) |
| 2718 | m5 := mload(0xa0) |
| 2719 | // Selector of `log(string,uint256,uint256)`. |
| 2720 | mstore(0x00, 0xca47c4eb) |
| 2721 | mstore(0x20, 0x60) |
| 2722 | mstore(0x40, p1) |
| 2723 | mstore(0x60, p2) |
| 2724 | writeString(0x80, p0) |
| 2725 | } |
| 2726 | _sendLogPayload(0x1c, 0xa4); |
| 2727 | /// @solidity memory-safe-assembly |
| 2728 | assembly { |
| 2729 | mstore(0x00, m0) |
| 2730 | mstore(0x20, m1) |
| 2731 | mstore(0x40, m2) |
| 2732 | mstore(0x60, m3) |
| 2733 | mstore(0x80, m4) |
| 2734 | mstore(0xa0, m5) |
| 2735 | } |
| 2736 | } |
| 2737 | |
| 2738 | function log(bytes32 p0, uint256 p1, bytes32 p2) internal pure { |
| 2739 | bytes32 m0; |
| 2740 | bytes32 m1; |
| 2741 | bytes32 m2; |
| 2742 | bytes32 m3; |
| 2743 | bytes32 m4; |
| 2744 | bytes32 m5; |
| 2745 | bytes32 m6; |
| 2746 | bytes32 m7; |
| 2747 | /// @solidity memory-safe-assembly |
| 2748 | assembly { |
| 2749 | function writeString(pos, w) { |
| 2750 | let length := 0 |
| 2751 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 2752 | mstore(pos, length) |
| 2753 | let shift := sub(256, shl(3, length)) |
| 2754 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 2755 | } |
| 2756 | m0 := mload(0x00) |
| 2757 | m1 := mload(0x20) |
| 2758 | m2 := mload(0x40) |
| 2759 | m3 := mload(0x60) |
| 2760 | m4 := mload(0x80) |
| 2761 | m5 := mload(0xa0) |
| 2762 | m6 := mload(0xc0) |
| 2763 | m7 := mload(0xe0) |
| 2764 | // Selector of `log(string,uint256,string)`. |
| 2765 | mstore(0x00, 0x5970e089) |
| 2766 | mstore(0x20, 0x60) |
| 2767 | mstore(0x40, p1) |
| 2768 | mstore(0x60, 0xa0) |
| 2769 | writeString(0x80, p0) |
| 2770 | writeString(0xc0, p2) |
| 2771 | } |
| 2772 | _sendLogPayload(0x1c, 0xe4); |
| 2773 | /// @solidity memory-safe-assembly |
| 2774 | assembly { |
| 2775 | mstore(0x00, m0) |
| 2776 | mstore(0x20, m1) |
| 2777 | mstore(0x40, m2) |
| 2778 | mstore(0x60, m3) |
| 2779 | mstore(0x80, m4) |
| 2780 | mstore(0xa0, m5) |
| 2781 | mstore(0xc0, m6) |
| 2782 | mstore(0xe0, m7) |
| 2783 | } |
| 2784 | } |
| 2785 | |
| 2786 | function log(bytes32 p0, bytes32 p1, address p2) internal pure { |
| 2787 | bytes32 m0; |
| 2788 | bytes32 m1; |
| 2789 | bytes32 m2; |
| 2790 | bytes32 m3; |
| 2791 | bytes32 m4; |
| 2792 | bytes32 m5; |
| 2793 | bytes32 m6; |
| 2794 | bytes32 m7; |
| 2795 | /// @solidity memory-safe-assembly |
| 2796 | assembly { |
| 2797 | function writeString(pos, w) { |
| 2798 | let length := 0 |
| 2799 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 2800 | mstore(pos, length) |
| 2801 | let shift := sub(256, shl(3, length)) |
| 2802 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 2803 | } |
| 2804 | m0 := mload(0x00) |
| 2805 | m1 := mload(0x20) |
| 2806 | m2 := mload(0x40) |
| 2807 | m3 := mload(0x60) |
| 2808 | m4 := mload(0x80) |
| 2809 | m5 := mload(0xa0) |
| 2810 | m6 := mload(0xc0) |
| 2811 | m7 := mload(0xe0) |
| 2812 | // Selector of `log(string,string,address)`. |
| 2813 | mstore(0x00, 0x95ed0195) |
| 2814 | mstore(0x20, 0x60) |
| 2815 | mstore(0x40, 0xa0) |
| 2816 | mstore(0x60, p2) |
| 2817 | writeString(0x80, p0) |
| 2818 | writeString(0xc0, p1) |
| 2819 | } |
| 2820 | _sendLogPayload(0x1c, 0xe4); |
| 2821 | /// @solidity memory-safe-assembly |
| 2822 | assembly { |
| 2823 | mstore(0x00, m0) |
| 2824 | mstore(0x20, m1) |
| 2825 | mstore(0x40, m2) |
| 2826 | mstore(0x60, m3) |
| 2827 | mstore(0x80, m4) |
| 2828 | mstore(0xa0, m5) |
| 2829 | mstore(0xc0, m6) |
| 2830 | mstore(0xe0, m7) |
| 2831 | } |
| 2832 | } |
| 2833 | |
| 2834 | function log(bytes32 p0, bytes32 p1, bool p2) internal pure { |
| 2835 | bytes32 m0; |
| 2836 | bytes32 m1; |
| 2837 | bytes32 m2; |
| 2838 | bytes32 m3; |
| 2839 | bytes32 m4; |
| 2840 | bytes32 m5; |
| 2841 | bytes32 m6; |
| 2842 | bytes32 m7; |
| 2843 | /// @solidity memory-safe-assembly |
| 2844 | assembly { |
| 2845 | function writeString(pos, w) { |
| 2846 | let length := 0 |
| 2847 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 2848 | mstore(pos, length) |
| 2849 | let shift := sub(256, shl(3, length)) |
| 2850 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 2851 | } |
| 2852 | m0 := mload(0x00) |
| 2853 | m1 := mload(0x20) |
| 2854 | m2 := mload(0x40) |
| 2855 | m3 := mload(0x60) |
| 2856 | m4 := mload(0x80) |
| 2857 | m5 := mload(0xa0) |
| 2858 | m6 := mload(0xc0) |
| 2859 | m7 := mload(0xe0) |
| 2860 | // Selector of `log(string,string,bool)`. |
| 2861 | mstore(0x00, 0xb0e0f9b5) |
| 2862 | mstore(0x20, 0x60) |
| 2863 | mstore(0x40, 0xa0) |
| 2864 | mstore(0x60, p2) |
| 2865 | writeString(0x80, p0) |
| 2866 | writeString(0xc0, p1) |
| 2867 | } |
| 2868 | _sendLogPayload(0x1c, 0xe4); |
| 2869 | /// @solidity memory-safe-assembly |
| 2870 | assembly { |
| 2871 | mstore(0x00, m0) |
| 2872 | mstore(0x20, m1) |
| 2873 | mstore(0x40, m2) |
| 2874 | mstore(0x60, m3) |
| 2875 | mstore(0x80, m4) |
| 2876 | mstore(0xa0, m5) |
| 2877 | mstore(0xc0, m6) |
| 2878 | mstore(0xe0, m7) |
| 2879 | } |
| 2880 | } |
| 2881 | |
| 2882 | function log(bytes32 p0, bytes32 p1, uint256 p2) internal pure { |
| 2883 | bytes32 m0; |
| 2884 | bytes32 m1; |
| 2885 | bytes32 m2; |
| 2886 | bytes32 m3; |
| 2887 | bytes32 m4; |
| 2888 | bytes32 m5; |
| 2889 | bytes32 m6; |
| 2890 | bytes32 m7; |
| 2891 | /// @solidity memory-safe-assembly |
| 2892 | assembly { |
| 2893 | function writeString(pos, w) { |
| 2894 | let length := 0 |
| 2895 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 2896 | mstore(pos, length) |
| 2897 | let shift := sub(256, shl(3, length)) |
| 2898 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 2899 | } |
| 2900 | m0 := mload(0x00) |
| 2901 | m1 := mload(0x20) |
| 2902 | m2 := mload(0x40) |
| 2903 | m3 := mload(0x60) |
| 2904 | m4 := mload(0x80) |
| 2905 | m5 := mload(0xa0) |
| 2906 | m6 := mload(0xc0) |
| 2907 | m7 := mload(0xe0) |
| 2908 | // Selector of `log(string,string,uint256)`. |
| 2909 | mstore(0x00, 0x5821efa1) |
| 2910 | mstore(0x20, 0x60) |
| 2911 | mstore(0x40, 0xa0) |
| 2912 | mstore(0x60, p2) |
| 2913 | writeString(0x80, p0) |
| 2914 | writeString(0xc0, p1) |
| 2915 | } |
| 2916 | _sendLogPayload(0x1c, 0xe4); |
| 2917 | /// @solidity memory-safe-assembly |
| 2918 | assembly { |
| 2919 | mstore(0x00, m0) |
| 2920 | mstore(0x20, m1) |
| 2921 | mstore(0x40, m2) |
| 2922 | mstore(0x60, m3) |
| 2923 | mstore(0x80, m4) |
| 2924 | mstore(0xa0, m5) |
| 2925 | mstore(0xc0, m6) |
| 2926 | mstore(0xe0, m7) |
| 2927 | } |
| 2928 | } |
| 2929 | |
| 2930 | function log(bytes32 p0, bytes32 p1, bytes32 p2) internal pure { |
| 2931 | bytes32 m0; |
| 2932 | bytes32 m1; |
| 2933 | bytes32 m2; |
| 2934 | bytes32 m3; |
| 2935 | bytes32 m4; |
| 2936 | bytes32 m5; |
| 2937 | bytes32 m6; |
| 2938 | bytes32 m7; |
| 2939 | bytes32 m8; |
| 2940 | bytes32 m9; |
| 2941 | /// @solidity memory-safe-assembly |
| 2942 | assembly { |
| 2943 | function writeString(pos, w) { |
| 2944 | let length := 0 |
| 2945 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 2946 | mstore(pos, length) |
| 2947 | let shift := sub(256, shl(3, length)) |
| 2948 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 2949 | } |
| 2950 | m0 := mload(0x00) |
| 2951 | m1 := mload(0x20) |
| 2952 | m2 := mload(0x40) |
| 2953 | m3 := mload(0x60) |
| 2954 | m4 := mload(0x80) |
| 2955 | m5 := mload(0xa0) |
| 2956 | m6 := mload(0xc0) |
| 2957 | m7 := mload(0xe0) |
| 2958 | m8 := mload(0x100) |
| 2959 | m9 := mload(0x120) |
| 2960 | // Selector of `log(string,string,string)`. |
| 2961 | mstore(0x00, 0x2ced7cef) |
| 2962 | mstore(0x20, 0x60) |
| 2963 | mstore(0x40, 0xa0) |
| 2964 | mstore(0x60, 0xe0) |
| 2965 | writeString(0x80, p0) |
| 2966 | writeString(0xc0, p1) |
| 2967 | writeString(0x100, p2) |
| 2968 | } |
| 2969 | _sendLogPayload(0x1c, 0x124); |
| 2970 | /// @solidity memory-safe-assembly |
| 2971 | assembly { |
| 2972 | mstore(0x00, m0) |
| 2973 | mstore(0x20, m1) |
| 2974 | mstore(0x40, m2) |
| 2975 | mstore(0x60, m3) |
| 2976 | mstore(0x80, m4) |
| 2977 | mstore(0xa0, m5) |
| 2978 | mstore(0xc0, m6) |
| 2979 | mstore(0xe0, m7) |
| 2980 | mstore(0x100, m8) |
| 2981 | mstore(0x120, m9) |
| 2982 | } |
| 2983 | } |
| 2984 | |
| 2985 | function log(address p0, address p1, address p2, address p3) internal pure { |
| 2986 | bytes32 m0; |
| 2987 | bytes32 m1; |
| 2988 | bytes32 m2; |
| 2989 | bytes32 m3; |
| 2990 | bytes32 m4; |
| 2991 | /// @solidity memory-safe-assembly |
| 2992 | assembly { |
| 2993 | m0 := mload(0x00) |
| 2994 | m1 := mload(0x20) |
| 2995 | m2 := mload(0x40) |
| 2996 | m3 := mload(0x60) |
| 2997 | m4 := mload(0x80) |
| 2998 | // Selector of `log(address,address,address,address)`. |
| 2999 | mstore(0x00, 0x665bf134) |
| 3000 | mstore(0x20, p0) |
| 3001 | mstore(0x40, p1) |
| 3002 | mstore(0x60, p2) |
| 3003 | mstore(0x80, p3) |
| 3004 | } |
| 3005 | _sendLogPayload(0x1c, 0x84); |
| 3006 | /// @solidity memory-safe-assembly |
| 3007 | assembly { |
| 3008 | mstore(0x00, m0) |
| 3009 | mstore(0x20, m1) |
| 3010 | mstore(0x40, m2) |
| 3011 | mstore(0x60, m3) |
| 3012 | mstore(0x80, m4) |
| 3013 | } |
| 3014 | } |
| 3015 | |
| 3016 | function log(address p0, address p1, address p2, bool p3) internal pure { |
| 3017 | bytes32 m0; |
| 3018 | bytes32 m1; |
| 3019 | bytes32 m2; |
| 3020 | bytes32 m3; |
| 3021 | bytes32 m4; |
| 3022 | /// @solidity memory-safe-assembly |
| 3023 | assembly { |
| 3024 | m0 := mload(0x00) |
| 3025 | m1 := mload(0x20) |
| 3026 | m2 := mload(0x40) |
| 3027 | m3 := mload(0x60) |
| 3028 | m4 := mload(0x80) |
| 3029 | // Selector of `log(address,address,address,bool)`. |
| 3030 | mstore(0x00, 0x0e378994) |
| 3031 | mstore(0x20, p0) |
| 3032 | mstore(0x40, p1) |
| 3033 | mstore(0x60, p2) |
| 3034 | mstore(0x80, p3) |
| 3035 | } |
| 3036 | _sendLogPayload(0x1c, 0x84); |
| 3037 | /// @solidity memory-safe-assembly |
| 3038 | assembly { |
| 3039 | mstore(0x00, m0) |
| 3040 | mstore(0x20, m1) |
| 3041 | mstore(0x40, m2) |
| 3042 | mstore(0x60, m3) |
| 3043 | mstore(0x80, m4) |
| 3044 | } |
| 3045 | } |
| 3046 | |
| 3047 | function log(address p0, address p1, address p2, uint256 p3) internal pure { |
| 3048 | bytes32 m0; |
| 3049 | bytes32 m1; |
| 3050 | bytes32 m2; |
| 3051 | bytes32 m3; |
| 3052 | bytes32 m4; |
| 3053 | /// @solidity memory-safe-assembly |
| 3054 | assembly { |
| 3055 | m0 := mload(0x00) |
| 3056 | m1 := mload(0x20) |
| 3057 | m2 := mload(0x40) |
| 3058 | m3 := mload(0x60) |
| 3059 | m4 := mload(0x80) |
| 3060 | // Selector of `log(address,address,address,uint256)`. |
| 3061 | mstore(0x00, 0x94250d77) |
| 3062 | mstore(0x20, p0) |
| 3063 | mstore(0x40, p1) |
| 3064 | mstore(0x60, p2) |
| 3065 | mstore(0x80, p3) |
| 3066 | } |
| 3067 | _sendLogPayload(0x1c, 0x84); |
| 3068 | /// @solidity memory-safe-assembly |
| 3069 | assembly { |
| 3070 | mstore(0x00, m0) |
| 3071 | mstore(0x20, m1) |
| 3072 | mstore(0x40, m2) |
| 3073 | mstore(0x60, m3) |
| 3074 | mstore(0x80, m4) |
| 3075 | } |
| 3076 | } |
| 3077 | |
| 3078 | function log(address p0, address p1, address p2, bytes32 p3) internal pure { |
| 3079 | bytes32 m0; |
| 3080 | bytes32 m1; |
| 3081 | bytes32 m2; |
| 3082 | bytes32 m3; |
| 3083 | bytes32 m4; |
| 3084 | bytes32 m5; |
| 3085 | bytes32 m6; |
| 3086 | /// @solidity memory-safe-assembly |
| 3087 | assembly { |
| 3088 | function writeString(pos, w) { |
| 3089 | let length := 0 |
| 3090 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 3091 | mstore(pos, length) |
| 3092 | let shift := sub(256, shl(3, length)) |
| 3093 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 3094 | } |
| 3095 | m0 := mload(0x00) |
| 3096 | m1 := mload(0x20) |
| 3097 | m2 := mload(0x40) |
| 3098 | m3 := mload(0x60) |
| 3099 | m4 := mload(0x80) |
| 3100 | m5 := mload(0xa0) |
| 3101 | m6 := mload(0xc0) |
| 3102 | // Selector of `log(address,address,address,string)`. |
| 3103 | mstore(0x00, 0xf808da20) |
| 3104 | mstore(0x20, p0) |
| 3105 | mstore(0x40, p1) |
| 3106 | mstore(0x60, p2) |
| 3107 | mstore(0x80, 0x80) |
| 3108 | writeString(0xa0, p3) |
| 3109 | } |
| 3110 | _sendLogPayload(0x1c, 0xc4); |
| 3111 | /// @solidity memory-safe-assembly |
| 3112 | assembly { |
| 3113 | mstore(0x00, m0) |
| 3114 | mstore(0x20, m1) |
| 3115 | mstore(0x40, m2) |
| 3116 | mstore(0x60, m3) |
| 3117 | mstore(0x80, m4) |
| 3118 | mstore(0xa0, m5) |
| 3119 | mstore(0xc0, m6) |
| 3120 | } |
| 3121 | } |
| 3122 | |
| 3123 | function log(address p0, address p1, bool p2, address p3) internal pure { |
| 3124 | bytes32 m0; |
| 3125 | bytes32 m1; |
| 3126 | bytes32 m2; |
| 3127 | bytes32 m3; |
| 3128 | bytes32 m4; |
| 3129 | /// @solidity memory-safe-assembly |
| 3130 | assembly { |
| 3131 | m0 := mload(0x00) |
| 3132 | m1 := mload(0x20) |
| 3133 | m2 := mload(0x40) |
| 3134 | m3 := mload(0x60) |
| 3135 | m4 := mload(0x80) |
| 3136 | // Selector of `log(address,address,bool,address)`. |
| 3137 | mstore(0x00, 0x9f1bc36e) |
| 3138 | mstore(0x20, p0) |
| 3139 | mstore(0x40, p1) |
| 3140 | mstore(0x60, p2) |
| 3141 | mstore(0x80, p3) |
| 3142 | } |
| 3143 | _sendLogPayload(0x1c, 0x84); |
| 3144 | /// @solidity memory-safe-assembly |
| 3145 | assembly { |
| 3146 | mstore(0x00, m0) |
| 3147 | mstore(0x20, m1) |
| 3148 | mstore(0x40, m2) |
| 3149 | mstore(0x60, m3) |
| 3150 | mstore(0x80, m4) |
| 3151 | } |
| 3152 | } |
| 3153 | |
| 3154 | function log(address p0, address p1, bool p2, bool p3) internal pure { |
| 3155 | bytes32 m0; |
| 3156 | bytes32 m1; |
| 3157 | bytes32 m2; |
| 3158 | bytes32 m3; |
| 3159 | bytes32 m4; |
| 3160 | /// @solidity memory-safe-assembly |
| 3161 | assembly { |
| 3162 | m0 := mload(0x00) |
| 3163 | m1 := mload(0x20) |
| 3164 | m2 := mload(0x40) |
| 3165 | m3 := mload(0x60) |
| 3166 | m4 := mload(0x80) |
| 3167 | // Selector of `log(address,address,bool,bool)`. |
| 3168 | mstore(0x00, 0x2cd4134a) |
| 3169 | mstore(0x20, p0) |
| 3170 | mstore(0x40, p1) |
| 3171 | mstore(0x60, p2) |
| 3172 | mstore(0x80, p3) |
| 3173 | } |
| 3174 | _sendLogPayload(0x1c, 0x84); |
| 3175 | /// @solidity memory-safe-assembly |
| 3176 | assembly { |
| 3177 | mstore(0x00, m0) |
| 3178 | mstore(0x20, m1) |
| 3179 | mstore(0x40, m2) |
| 3180 | mstore(0x60, m3) |
| 3181 | mstore(0x80, m4) |
| 3182 | } |
| 3183 | } |
| 3184 | |
| 3185 | function log(address p0, address p1, bool p2, uint256 p3) internal pure { |
| 3186 | bytes32 m0; |
| 3187 | bytes32 m1; |
| 3188 | bytes32 m2; |
| 3189 | bytes32 m3; |
| 3190 | bytes32 m4; |
| 3191 | /// @solidity memory-safe-assembly |
| 3192 | assembly { |
| 3193 | m0 := mload(0x00) |
| 3194 | m1 := mload(0x20) |
| 3195 | m2 := mload(0x40) |
| 3196 | m3 := mload(0x60) |
| 3197 | m4 := mload(0x80) |
| 3198 | // Selector of `log(address,address,bool,uint256)`. |
| 3199 | mstore(0x00, 0x3971e78c) |
| 3200 | mstore(0x20, p0) |
| 3201 | mstore(0x40, p1) |
| 3202 | mstore(0x60, p2) |
| 3203 | mstore(0x80, p3) |
| 3204 | } |
| 3205 | _sendLogPayload(0x1c, 0x84); |
| 3206 | /// @solidity memory-safe-assembly |
| 3207 | assembly { |
| 3208 | mstore(0x00, m0) |
| 3209 | mstore(0x20, m1) |
| 3210 | mstore(0x40, m2) |
| 3211 | mstore(0x60, m3) |
| 3212 | mstore(0x80, m4) |
| 3213 | } |
| 3214 | } |
| 3215 | |
| 3216 | function log(address p0, address p1, bool p2, bytes32 p3) internal pure { |
| 3217 | bytes32 m0; |
| 3218 | bytes32 m1; |
| 3219 | bytes32 m2; |
| 3220 | bytes32 m3; |
| 3221 | bytes32 m4; |
| 3222 | bytes32 m5; |
| 3223 | bytes32 m6; |
| 3224 | /// @solidity memory-safe-assembly |
| 3225 | assembly { |
| 3226 | function writeString(pos, w) { |
| 3227 | let length := 0 |
| 3228 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 3229 | mstore(pos, length) |
| 3230 | let shift := sub(256, shl(3, length)) |
| 3231 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 3232 | } |
| 3233 | m0 := mload(0x00) |
| 3234 | m1 := mload(0x20) |
| 3235 | m2 := mload(0x40) |
| 3236 | m3 := mload(0x60) |
| 3237 | m4 := mload(0x80) |
| 3238 | m5 := mload(0xa0) |
| 3239 | m6 := mload(0xc0) |
| 3240 | // Selector of `log(address,address,bool,string)`. |
| 3241 | mstore(0x00, 0xaa6540c8) |
| 3242 | mstore(0x20, p0) |
| 3243 | mstore(0x40, p1) |
| 3244 | mstore(0x60, p2) |
| 3245 | mstore(0x80, 0x80) |
| 3246 | writeString(0xa0, p3) |
| 3247 | } |
| 3248 | _sendLogPayload(0x1c, 0xc4); |
| 3249 | /// @solidity memory-safe-assembly |
| 3250 | assembly { |
| 3251 | mstore(0x00, m0) |
| 3252 | mstore(0x20, m1) |
| 3253 | mstore(0x40, m2) |
| 3254 | mstore(0x60, m3) |
| 3255 | mstore(0x80, m4) |
| 3256 | mstore(0xa0, m5) |
| 3257 | mstore(0xc0, m6) |
| 3258 | } |
| 3259 | } |
| 3260 | |
| 3261 | function log(address p0, address p1, uint256 p2, address p3) internal pure { |
| 3262 | bytes32 m0; |
| 3263 | bytes32 m1; |
| 3264 | bytes32 m2; |
| 3265 | bytes32 m3; |
| 3266 | bytes32 m4; |
| 3267 | /// @solidity memory-safe-assembly |
| 3268 | assembly { |
| 3269 | m0 := mload(0x00) |
| 3270 | m1 := mload(0x20) |
| 3271 | m2 := mload(0x40) |
| 3272 | m3 := mload(0x60) |
| 3273 | m4 := mload(0x80) |
| 3274 | // Selector of `log(address,address,uint256,address)`. |
| 3275 | mstore(0x00, 0x8da6def5) |
| 3276 | mstore(0x20, p0) |
| 3277 | mstore(0x40, p1) |
| 3278 | mstore(0x60, p2) |
| 3279 | mstore(0x80, p3) |
| 3280 | } |
| 3281 | _sendLogPayload(0x1c, 0x84); |
| 3282 | /// @solidity memory-safe-assembly |
| 3283 | assembly { |
| 3284 | mstore(0x00, m0) |
| 3285 | mstore(0x20, m1) |
| 3286 | mstore(0x40, m2) |
| 3287 | mstore(0x60, m3) |
| 3288 | mstore(0x80, m4) |
| 3289 | } |
| 3290 | } |
| 3291 | |
| 3292 | function log(address p0, address p1, uint256 p2, bool p3) internal pure { |
| 3293 | bytes32 m0; |
| 3294 | bytes32 m1; |
| 3295 | bytes32 m2; |
| 3296 | bytes32 m3; |
| 3297 | bytes32 m4; |
| 3298 | /// @solidity memory-safe-assembly |
| 3299 | assembly { |
| 3300 | m0 := mload(0x00) |
| 3301 | m1 := mload(0x20) |
| 3302 | m2 := mload(0x40) |
| 3303 | m3 := mload(0x60) |
| 3304 | m4 := mload(0x80) |
| 3305 | // Selector of `log(address,address,uint256,bool)`. |
| 3306 | mstore(0x00, 0x9b4254e2) |
| 3307 | mstore(0x20, p0) |
| 3308 | mstore(0x40, p1) |
| 3309 | mstore(0x60, p2) |
| 3310 | mstore(0x80, p3) |
| 3311 | } |
| 3312 | _sendLogPayload(0x1c, 0x84); |
| 3313 | /// @solidity memory-safe-assembly |
| 3314 | assembly { |
| 3315 | mstore(0x00, m0) |
| 3316 | mstore(0x20, m1) |
| 3317 | mstore(0x40, m2) |
| 3318 | mstore(0x60, m3) |
| 3319 | mstore(0x80, m4) |
| 3320 | } |
| 3321 | } |
| 3322 | |
| 3323 | function log(address p0, address p1, uint256 p2, uint256 p3) internal pure { |
| 3324 | bytes32 m0; |
| 3325 | bytes32 m1; |
| 3326 | bytes32 m2; |
| 3327 | bytes32 m3; |
| 3328 | bytes32 m4; |
| 3329 | /// @solidity memory-safe-assembly |
| 3330 | assembly { |
| 3331 | m0 := mload(0x00) |
| 3332 | m1 := mload(0x20) |
| 3333 | m2 := mload(0x40) |
| 3334 | m3 := mload(0x60) |
| 3335 | m4 := mload(0x80) |
| 3336 | // Selector of `log(address,address,uint256,uint256)`. |
| 3337 | mstore(0x00, 0xbe553481) |
| 3338 | mstore(0x20, p0) |
| 3339 | mstore(0x40, p1) |
| 3340 | mstore(0x60, p2) |
| 3341 | mstore(0x80, p3) |
| 3342 | } |
| 3343 | _sendLogPayload(0x1c, 0x84); |
| 3344 | /// @solidity memory-safe-assembly |
| 3345 | assembly { |
| 3346 | mstore(0x00, m0) |
| 3347 | mstore(0x20, m1) |
| 3348 | mstore(0x40, m2) |
| 3349 | mstore(0x60, m3) |
| 3350 | mstore(0x80, m4) |
| 3351 | } |
| 3352 | } |
| 3353 | |
| 3354 | function log(address p0, address p1, uint256 p2, bytes32 p3) internal pure { |
| 3355 | bytes32 m0; |
| 3356 | bytes32 m1; |
| 3357 | bytes32 m2; |
| 3358 | bytes32 m3; |
| 3359 | bytes32 m4; |
| 3360 | bytes32 m5; |
| 3361 | bytes32 m6; |
| 3362 | /// @solidity memory-safe-assembly |
| 3363 | assembly { |
| 3364 | function writeString(pos, w) { |
| 3365 | let length := 0 |
| 3366 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 3367 | mstore(pos, length) |
| 3368 | let shift := sub(256, shl(3, length)) |
| 3369 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 3370 | } |
| 3371 | m0 := mload(0x00) |
| 3372 | m1 := mload(0x20) |
| 3373 | m2 := mload(0x40) |
| 3374 | m3 := mload(0x60) |
| 3375 | m4 := mload(0x80) |
| 3376 | m5 := mload(0xa0) |
| 3377 | m6 := mload(0xc0) |
| 3378 | // Selector of `log(address,address,uint256,string)`. |
| 3379 | mstore(0x00, 0xfdb4f990) |
| 3380 | mstore(0x20, p0) |
| 3381 | mstore(0x40, p1) |
| 3382 | mstore(0x60, p2) |
| 3383 | mstore(0x80, 0x80) |
| 3384 | writeString(0xa0, p3) |
| 3385 | } |
| 3386 | _sendLogPayload(0x1c, 0xc4); |
| 3387 | /// @solidity memory-safe-assembly |
| 3388 | assembly { |
| 3389 | mstore(0x00, m0) |
| 3390 | mstore(0x20, m1) |
| 3391 | mstore(0x40, m2) |
| 3392 | mstore(0x60, m3) |
| 3393 | mstore(0x80, m4) |
| 3394 | mstore(0xa0, m5) |
| 3395 | mstore(0xc0, m6) |
| 3396 | } |
| 3397 | } |
| 3398 | |
| 3399 | function log(address p0, address p1, bytes32 p2, address p3) internal pure { |
| 3400 | bytes32 m0; |
| 3401 | bytes32 m1; |
| 3402 | bytes32 m2; |
| 3403 | bytes32 m3; |
| 3404 | bytes32 m4; |
| 3405 | bytes32 m5; |
| 3406 | bytes32 m6; |
| 3407 | /// @solidity memory-safe-assembly |
| 3408 | assembly { |
| 3409 | function writeString(pos, w) { |
| 3410 | let length := 0 |
| 3411 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 3412 | mstore(pos, length) |
| 3413 | let shift := sub(256, shl(3, length)) |
| 3414 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 3415 | } |
| 3416 | m0 := mload(0x00) |
| 3417 | m1 := mload(0x20) |
| 3418 | m2 := mload(0x40) |
| 3419 | m3 := mload(0x60) |
| 3420 | m4 := mload(0x80) |
| 3421 | m5 := mload(0xa0) |
| 3422 | m6 := mload(0xc0) |
| 3423 | // Selector of `log(address,address,string,address)`. |
| 3424 | mstore(0x00, 0x8f736d16) |
| 3425 | mstore(0x20, p0) |
| 3426 | mstore(0x40, p1) |
| 3427 | mstore(0x60, 0x80) |
| 3428 | mstore(0x80, p3) |
| 3429 | writeString(0xa0, p2) |
| 3430 | } |
| 3431 | _sendLogPayload(0x1c, 0xc4); |
| 3432 | /// @solidity memory-safe-assembly |
| 3433 | assembly { |
| 3434 | mstore(0x00, m0) |
| 3435 | mstore(0x20, m1) |
| 3436 | mstore(0x40, m2) |
| 3437 | mstore(0x60, m3) |
| 3438 | mstore(0x80, m4) |
| 3439 | mstore(0xa0, m5) |
| 3440 | mstore(0xc0, m6) |
| 3441 | } |
| 3442 | } |
| 3443 | |
| 3444 | function log(address p0, address p1, bytes32 p2, bool p3) internal pure { |
| 3445 | bytes32 m0; |
| 3446 | bytes32 m1; |
| 3447 | bytes32 m2; |
| 3448 | bytes32 m3; |
| 3449 | bytes32 m4; |
| 3450 | bytes32 m5; |
| 3451 | bytes32 m6; |
| 3452 | /// @solidity memory-safe-assembly |
| 3453 | assembly { |
| 3454 | function writeString(pos, w) { |
| 3455 | let length := 0 |
| 3456 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 3457 | mstore(pos, length) |
| 3458 | let shift := sub(256, shl(3, length)) |
| 3459 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 3460 | } |
| 3461 | m0 := mload(0x00) |
| 3462 | m1 := mload(0x20) |
| 3463 | m2 := mload(0x40) |
| 3464 | m3 := mload(0x60) |
| 3465 | m4 := mload(0x80) |
| 3466 | m5 := mload(0xa0) |
| 3467 | m6 := mload(0xc0) |
| 3468 | // Selector of `log(address,address,string,bool)`. |
| 3469 | mstore(0x00, 0x6f1a594e) |
| 3470 | mstore(0x20, p0) |
| 3471 | mstore(0x40, p1) |
| 3472 | mstore(0x60, 0x80) |
| 3473 | mstore(0x80, p3) |
| 3474 | writeString(0xa0, p2) |
| 3475 | } |
| 3476 | _sendLogPayload(0x1c, 0xc4); |
| 3477 | /// @solidity memory-safe-assembly |
| 3478 | assembly { |
| 3479 | mstore(0x00, m0) |
| 3480 | mstore(0x20, m1) |
| 3481 | mstore(0x40, m2) |
| 3482 | mstore(0x60, m3) |
| 3483 | mstore(0x80, m4) |
| 3484 | mstore(0xa0, m5) |
| 3485 | mstore(0xc0, m6) |
| 3486 | } |
| 3487 | } |
| 3488 | |
| 3489 | function log(address p0, address p1, bytes32 p2, uint256 p3) internal pure { |
| 3490 | bytes32 m0; |
| 3491 | bytes32 m1; |
| 3492 | bytes32 m2; |
| 3493 | bytes32 m3; |
| 3494 | bytes32 m4; |
| 3495 | bytes32 m5; |
| 3496 | bytes32 m6; |
| 3497 | /// @solidity memory-safe-assembly |
| 3498 | assembly { |
| 3499 | function writeString(pos, w) { |
| 3500 | let length := 0 |
| 3501 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 3502 | mstore(pos, length) |
| 3503 | let shift := sub(256, shl(3, length)) |
| 3504 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 3505 | } |
| 3506 | m0 := mload(0x00) |
| 3507 | m1 := mload(0x20) |
| 3508 | m2 := mload(0x40) |
| 3509 | m3 := mload(0x60) |
| 3510 | m4 := mload(0x80) |
| 3511 | m5 := mload(0xa0) |
| 3512 | m6 := mload(0xc0) |
| 3513 | // Selector of `log(address,address,string,uint256)`. |
| 3514 | mstore(0x00, 0xef1cefe7) |
| 3515 | mstore(0x20, p0) |
| 3516 | mstore(0x40, p1) |
| 3517 | mstore(0x60, 0x80) |
| 3518 | mstore(0x80, p3) |
| 3519 | writeString(0xa0, p2) |
| 3520 | } |
| 3521 | _sendLogPayload(0x1c, 0xc4); |
| 3522 | /// @solidity memory-safe-assembly |
| 3523 | assembly { |
| 3524 | mstore(0x00, m0) |
| 3525 | mstore(0x20, m1) |
| 3526 | mstore(0x40, m2) |
| 3527 | mstore(0x60, m3) |
| 3528 | mstore(0x80, m4) |
| 3529 | mstore(0xa0, m5) |
| 3530 | mstore(0xc0, m6) |
| 3531 | } |
| 3532 | } |
| 3533 | |
| 3534 | function log(address p0, address p1, bytes32 p2, bytes32 p3) internal pure { |
| 3535 | bytes32 m0; |
| 3536 | bytes32 m1; |
| 3537 | bytes32 m2; |
| 3538 | bytes32 m3; |
| 3539 | bytes32 m4; |
| 3540 | bytes32 m5; |
| 3541 | bytes32 m6; |
| 3542 | bytes32 m7; |
| 3543 | bytes32 m8; |
| 3544 | /// @solidity memory-safe-assembly |
| 3545 | assembly { |
| 3546 | function writeString(pos, w) { |
| 3547 | let length := 0 |
| 3548 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 3549 | mstore(pos, length) |
| 3550 | let shift := sub(256, shl(3, length)) |
| 3551 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 3552 | } |
| 3553 | m0 := mload(0x00) |
| 3554 | m1 := mload(0x20) |
| 3555 | m2 := mload(0x40) |
| 3556 | m3 := mload(0x60) |
| 3557 | m4 := mload(0x80) |
| 3558 | m5 := mload(0xa0) |
| 3559 | m6 := mload(0xc0) |
| 3560 | m7 := mload(0xe0) |
| 3561 | m8 := mload(0x100) |
| 3562 | // Selector of `log(address,address,string,string)`. |
| 3563 | mstore(0x00, 0x21bdaf25) |
| 3564 | mstore(0x20, p0) |
| 3565 | mstore(0x40, p1) |
| 3566 | mstore(0x60, 0x80) |
| 3567 | mstore(0x80, 0xc0) |
| 3568 | writeString(0xa0, p2) |
| 3569 | writeString(0xe0, p3) |
| 3570 | } |
| 3571 | _sendLogPayload(0x1c, 0x104); |
| 3572 | /// @solidity memory-safe-assembly |
| 3573 | assembly { |
| 3574 | mstore(0x00, m0) |
| 3575 | mstore(0x20, m1) |
| 3576 | mstore(0x40, m2) |
| 3577 | mstore(0x60, m3) |
| 3578 | mstore(0x80, m4) |
| 3579 | mstore(0xa0, m5) |
| 3580 | mstore(0xc0, m6) |
| 3581 | mstore(0xe0, m7) |
| 3582 | mstore(0x100, m8) |
| 3583 | } |
| 3584 | } |
| 3585 | |
| 3586 | function log(address p0, bool p1, address p2, address p3) internal pure { |
| 3587 | bytes32 m0; |
| 3588 | bytes32 m1; |
| 3589 | bytes32 m2; |
| 3590 | bytes32 m3; |
| 3591 | bytes32 m4; |
| 3592 | /// @solidity memory-safe-assembly |
| 3593 | assembly { |
| 3594 | m0 := mload(0x00) |
| 3595 | m1 := mload(0x20) |
| 3596 | m2 := mload(0x40) |
| 3597 | m3 := mload(0x60) |
| 3598 | m4 := mload(0x80) |
| 3599 | // Selector of `log(address,bool,address,address)`. |
| 3600 | mstore(0x00, 0x660375dd) |
| 3601 | mstore(0x20, p0) |
| 3602 | mstore(0x40, p1) |
| 3603 | mstore(0x60, p2) |
| 3604 | mstore(0x80, p3) |
| 3605 | } |
| 3606 | _sendLogPayload(0x1c, 0x84); |
| 3607 | /// @solidity memory-safe-assembly |
| 3608 | assembly { |
| 3609 | mstore(0x00, m0) |
| 3610 | mstore(0x20, m1) |
| 3611 | mstore(0x40, m2) |
| 3612 | mstore(0x60, m3) |
| 3613 | mstore(0x80, m4) |
| 3614 | } |
| 3615 | } |
| 3616 | |
| 3617 | function log(address p0, bool p1, address p2, bool p3) internal pure { |
| 3618 | bytes32 m0; |
| 3619 | bytes32 m1; |
| 3620 | bytes32 m2; |
| 3621 | bytes32 m3; |
| 3622 | bytes32 m4; |
| 3623 | /// @solidity memory-safe-assembly |
| 3624 | assembly { |
| 3625 | m0 := mload(0x00) |
| 3626 | m1 := mload(0x20) |
| 3627 | m2 := mload(0x40) |
| 3628 | m3 := mload(0x60) |
| 3629 | m4 := mload(0x80) |
| 3630 | // Selector of `log(address,bool,address,bool)`. |
| 3631 | mstore(0x00, 0xa6f50b0f) |
| 3632 | mstore(0x20, p0) |
| 3633 | mstore(0x40, p1) |
| 3634 | mstore(0x60, p2) |
| 3635 | mstore(0x80, p3) |
| 3636 | } |
| 3637 | _sendLogPayload(0x1c, 0x84); |
| 3638 | /// @solidity memory-safe-assembly |
| 3639 | assembly { |
| 3640 | mstore(0x00, m0) |
| 3641 | mstore(0x20, m1) |
| 3642 | mstore(0x40, m2) |
| 3643 | mstore(0x60, m3) |
| 3644 | mstore(0x80, m4) |
| 3645 | } |
| 3646 | } |
| 3647 | |
| 3648 | function log(address p0, bool p1, address p2, uint256 p3) internal pure { |
| 3649 | bytes32 m0; |
| 3650 | bytes32 m1; |
| 3651 | bytes32 m2; |
| 3652 | bytes32 m3; |
| 3653 | bytes32 m4; |
| 3654 | /// @solidity memory-safe-assembly |
| 3655 | assembly { |
| 3656 | m0 := mload(0x00) |
| 3657 | m1 := mload(0x20) |
| 3658 | m2 := mload(0x40) |
| 3659 | m3 := mload(0x60) |
| 3660 | m4 := mload(0x80) |
| 3661 | // Selector of `log(address,bool,address,uint256)`. |
| 3662 | mstore(0x00, 0xa75c59de) |
| 3663 | mstore(0x20, p0) |
| 3664 | mstore(0x40, p1) |
| 3665 | mstore(0x60, p2) |
| 3666 | mstore(0x80, p3) |
| 3667 | } |
| 3668 | _sendLogPayload(0x1c, 0x84); |
| 3669 | /// @solidity memory-safe-assembly |
| 3670 | assembly { |
| 3671 | mstore(0x00, m0) |
| 3672 | mstore(0x20, m1) |
| 3673 | mstore(0x40, m2) |
| 3674 | mstore(0x60, m3) |
| 3675 | mstore(0x80, m4) |
| 3676 | } |
| 3677 | } |
| 3678 | |
| 3679 | function log(address p0, bool p1, address p2, bytes32 p3) internal pure { |
| 3680 | bytes32 m0; |
| 3681 | bytes32 m1; |
| 3682 | bytes32 m2; |
| 3683 | bytes32 m3; |
| 3684 | bytes32 m4; |
| 3685 | bytes32 m5; |
| 3686 | bytes32 m6; |
| 3687 | /// @solidity memory-safe-assembly |
| 3688 | assembly { |
| 3689 | function writeString(pos, w) { |
| 3690 | let length := 0 |
| 3691 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 3692 | mstore(pos, length) |
| 3693 | let shift := sub(256, shl(3, length)) |
| 3694 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 3695 | } |
| 3696 | m0 := mload(0x00) |
| 3697 | m1 := mload(0x20) |
| 3698 | m2 := mload(0x40) |
| 3699 | m3 := mload(0x60) |
| 3700 | m4 := mload(0x80) |
| 3701 | m5 := mload(0xa0) |
| 3702 | m6 := mload(0xc0) |
| 3703 | // Selector of `log(address,bool,address,string)`. |
| 3704 | mstore(0x00, 0x2dd778e6) |
| 3705 | mstore(0x20, p0) |
| 3706 | mstore(0x40, p1) |
| 3707 | mstore(0x60, p2) |
| 3708 | mstore(0x80, 0x80) |
| 3709 | writeString(0xa0, p3) |
| 3710 | } |
| 3711 | _sendLogPayload(0x1c, 0xc4); |
| 3712 | /// @solidity memory-safe-assembly |
| 3713 | assembly { |
| 3714 | mstore(0x00, m0) |
| 3715 | mstore(0x20, m1) |
| 3716 | mstore(0x40, m2) |
| 3717 | mstore(0x60, m3) |
| 3718 | mstore(0x80, m4) |
| 3719 | mstore(0xa0, m5) |
| 3720 | mstore(0xc0, m6) |
| 3721 | } |
| 3722 | } |
| 3723 | |
| 3724 | function log(address p0, bool p1, bool p2, address p3) internal pure { |
| 3725 | bytes32 m0; |
| 3726 | bytes32 m1; |
| 3727 | bytes32 m2; |
| 3728 | bytes32 m3; |
| 3729 | bytes32 m4; |
| 3730 | /// @solidity memory-safe-assembly |
| 3731 | assembly { |
| 3732 | m0 := mload(0x00) |
| 3733 | m1 := mload(0x20) |
| 3734 | m2 := mload(0x40) |
| 3735 | m3 := mload(0x60) |
| 3736 | m4 := mload(0x80) |
| 3737 | // Selector of `log(address,bool,bool,address)`. |
| 3738 | mstore(0x00, 0xcf394485) |
| 3739 | mstore(0x20, p0) |
| 3740 | mstore(0x40, p1) |
| 3741 | mstore(0x60, p2) |
| 3742 | mstore(0x80, p3) |
| 3743 | } |
| 3744 | _sendLogPayload(0x1c, 0x84); |
| 3745 | /// @solidity memory-safe-assembly |
| 3746 | assembly { |
| 3747 | mstore(0x00, m0) |
| 3748 | mstore(0x20, m1) |
| 3749 | mstore(0x40, m2) |
| 3750 | mstore(0x60, m3) |
| 3751 | mstore(0x80, m4) |
| 3752 | } |
| 3753 | } |
| 3754 | |
| 3755 | function log(address p0, bool p1, bool p2, bool p3) internal pure { |
| 3756 | bytes32 m0; |
| 3757 | bytes32 m1; |
| 3758 | bytes32 m2; |
| 3759 | bytes32 m3; |
| 3760 | bytes32 m4; |
| 3761 | /// @solidity memory-safe-assembly |
| 3762 | assembly { |
| 3763 | m0 := mload(0x00) |
| 3764 | m1 := mload(0x20) |
| 3765 | m2 := mload(0x40) |
| 3766 | m3 := mload(0x60) |
| 3767 | m4 := mload(0x80) |
| 3768 | // Selector of `log(address,bool,bool,bool)`. |
| 3769 | mstore(0x00, 0xcac43479) |
| 3770 | mstore(0x20, p0) |
| 3771 | mstore(0x40, p1) |
| 3772 | mstore(0x60, p2) |
| 3773 | mstore(0x80, p3) |
| 3774 | } |
| 3775 | _sendLogPayload(0x1c, 0x84); |
| 3776 | /// @solidity memory-safe-assembly |
| 3777 | assembly { |
| 3778 | mstore(0x00, m0) |
| 3779 | mstore(0x20, m1) |
| 3780 | mstore(0x40, m2) |
| 3781 | mstore(0x60, m3) |
| 3782 | mstore(0x80, m4) |
| 3783 | } |
| 3784 | } |
| 3785 | |
| 3786 | function log(address p0, bool p1, bool p2, uint256 p3) internal pure { |
| 3787 | bytes32 m0; |
| 3788 | bytes32 m1; |
| 3789 | bytes32 m2; |
| 3790 | bytes32 m3; |
| 3791 | bytes32 m4; |
| 3792 | /// @solidity memory-safe-assembly |
| 3793 | assembly { |
| 3794 | m0 := mload(0x00) |
| 3795 | m1 := mload(0x20) |
| 3796 | m2 := mload(0x40) |
| 3797 | m3 := mload(0x60) |
| 3798 | m4 := mload(0x80) |
| 3799 | // Selector of `log(address,bool,bool,uint256)`. |
| 3800 | mstore(0x00, 0x8c4e5de6) |
| 3801 | mstore(0x20, p0) |
| 3802 | mstore(0x40, p1) |
| 3803 | mstore(0x60, p2) |
| 3804 | mstore(0x80, p3) |
| 3805 | } |
| 3806 | _sendLogPayload(0x1c, 0x84); |
| 3807 | /// @solidity memory-safe-assembly |
| 3808 | assembly { |
| 3809 | mstore(0x00, m0) |
| 3810 | mstore(0x20, m1) |
| 3811 | mstore(0x40, m2) |
| 3812 | mstore(0x60, m3) |
| 3813 | mstore(0x80, m4) |
| 3814 | } |
| 3815 | } |
| 3816 | |
| 3817 | function log(address p0, bool p1, bool p2, bytes32 p3) internal pure { |
| 3818 | bytes32 m0; |
| 3819 | bytes32 m1; |
| 3820 | bytes32 m2; |
| 3821 | bytes32 m3; |
| 3822 | bytes32 m4; |
| 3823 | bytes32 m5; |
| 3824 | bytes32 m6; |
| 3825 | /// @solidity memory-safe-assembly |
| 3826 | assembly { |
| 3827 | function writeString(pos, w) { |
| 3828 | let length := 0 |
| 3829 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 3830 | mstore(pos, length) |
| 3831 | let shift := sub(256, shl(3, length)) |
| 3832 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 3833 | } |
| 3834 | m0 := mload(0x00) |
| 3835 | m1 := mload(0x20) |
| 3836 | m2 := mload(0x40) |
| 3837 | m3 := mload(0x60) |
| 3838 | m4 := mload(0x80) |
| 3839 | m5 := mload(0xa0) |
| 3840 | m6 := mload(0xc0) |
| 3841 | // Selector of `log(address,bool,bool,string)`. |
| 3842 | mstore(0x00, 0xdfc4a2e8) |
| 3843 | mstore(0x20, p0) |
| 3844 | mstore(0x40, p1) |
| 3845 | mstore(0x60, p2) |
| 3846 | mstore(0x80, 0x80) |
| 3847 | writeString(0xa0, p3) |
| 3848 | } |
| 3849 | _sendLogPayload(0x1c, 0xc4); |
| 3850 | /// @solidity memory-safe-assembly |
| 3851 | assembly { |
| 3852 | mstore(0x00, m0) |
| 3853 | mstore(0x20, m1) |
| 3854 | mstore(0x40, m2) |
| 3855 | mstore(0x60, m3) |
| 3856 | mstore(0x80, m4) |
| 3857 | mstore(0xa0, m5) |
| 3858 | mstore(0xc0, m6) |
| 3859 | } |
| 3860 | } |
| 3861 | |
| 3862 | function log(address p0, bool p1, uint256 p2, address p3) internal pure { |
| 3863 | bytes32 m0; |
| 3864 | bytes32 m1; |
| 3865 | bytes32 m2; |
| 3866 | bytes32 m3; |
| 3867 | bytes32 m4; |
| 3868 | /// @solidity memory-safe-assembly |
| 3869 | assembly { |
| 3870 | m0 := mload(0x00) |
| 3871 | m1 := mload(0x20) |
| 3872 | m2 := mload(0x40) |
| 3873 | m3 := mload(0x60) |
| 3874 | m4 := mload(0x80) |
| 3875 | // Selector of `log(address,bool,uint256,address)`. |
| 3876 | mstore(0x00, 0xccf790a1) |
| 3877 | mstore(0x20, p0) |
| 3878 | mstore(0x40, p1) |
| 3879 | mstore(0x60, p2) |
| 3880 | mstore(0x80, p3) |
| 3881 | } |
| 3882 | _sendLogPayload(0x1c, 0x84); |
| 3883 | /// @solidity memory-safe-assembly |
| 3884 | assembly { |
| 3885 | mstore(0x00, m0) |
| 3886 | mstore(0x20, m1) |
| 3887 | mstore(0x40, m2) |
| 3888 | mstore(0x60, m3) |
| 3889 | mstore(0x80, m4) |
| 3890 | } |
| 3891 | } |
| 3892 | |
| 3893 | function log(address p0, bool p1, uint256 p2, bool p3) internal pure { |
| 3894 | bytes32 m0; |
| 3895 | bytes32 m1; |
| 3896 | bytes32 m2; |
| 3897 | bytes32 m3; |
| 3898 | bytes32 m4; |
| 3899 | /// @solidity memory-safe-assembly |
| 3900 | assembly { |
| 3901 | m0 := mload(0x00) |
| 3902 | m1 := mload(0x20) |
| 3903 | m2 := mload(0x40) |
| 3904 | m3 := mload(0x60) |
| 3905 | m4 := mload(0x80) |
| 3906 | // Selector of `log(address,bool,uint256,bool)`. |
| 3907 | mstore(0x00, 0xc4643e20) |
| 3908 | mstore(0x20, p0) |
| 3909 | mstore(0x40, p1) |
| 3910 | mstore(0x60, p2) |
| 3911 | mstore(0x80, p3) |
| 3912 | } |
| 3913 | _sendLogPayload(0x1c, 0x84); |
| 3914 | /// @solidity memory-safe-assembly |
| 3915 | assembly { |
| 3916 | mstore(0x00, m0) |
| 3917 | mstore(0x20, m1) |
| 3918 | mstore(0x40, m2) |
| 3919 | mstore(0x60, m3) |
| 3920 | mstore(0x80, m4) |
| 3921 | } |
| 3922 | } |
| 3923 | |
| 3924 | function log(address p0, bool p1, uint256 p2, uint256 p3) internal pure { |
| 3925 | bytes32 m0; |
| 3926 | bytes32 m1; |
| 3927 | bytes32 m2; |
| 3928 | bytes32 m3; |
| 3929 | bytes32 m4; |
| 3930 | /// @solidity memory-safe-assembly |
| 3931 | assembly { |
| 3932 | m0 := mload(0x00) |
| 3933 | m1 := mload(0x20) |
| 3934 | m2 := mload(0x40) |
| 3935 | m3 := mload(0x60) |
| 3936 | m4 := mload(0x80) |
| 3937 | // Selector of `log(address,bool,uint256,uint256)`. |
| 3938 | mstore(0x00, 0x386ff5f4) |
| 3939 | mstore(0x20, p0) |
| 3940 | mstore(0x40, p1) |
| 3941 | mstore(0x60, p2) |
| 3942 | mstore(0x80, p3) |
| 3943 | } |
| 3944 | _sendLogPayload(0x1c, 0x84); |
| 3945 | /// @solidity memory-safe-assembly |
| 3946 | assembly { |
| 3947 | mstore(0x00, m0) |
| 3948 | mstore(0x20, m1) |
| 3949 | mstore(0x40, m2) |
| 3950 | mstore(0x60, m3) |
| 3951 | mstore(0x80, m4) |
| 3952 | } |
| 3953 | } |
| 3954 | |
| 3955 | function log(address p0, bool p1, uint256 p2, bytes32 p3) internal pure { |
| 3956 | bytes32 m0; |
| 3957 | bytes32 m1; |
| 3958 | bytes32 m2; |
| 3959 | bytes32 m3; |
| 3960 | bytes32 m4; |
| 3961 | bytes32 m5; |
| 3962 | bytes32 m6; |
| 3963 | /// @solidity memory-safe-assembly |
| 3964 | assembly { |
| 3965 | function writeString(pos, w) { |
| 3966 | let length := 0 |
| 3967 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 3968 | mstore(pos, length) |
| 3969 | let shift := sub(256, shl(3, length)) |
| 3970 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 3971 | } |
| 3972 | m0 := mload(0x00) |
| 3973 | m1 := mload(0x20) |
| 3974 | m2 := mload(0x40) |
| 3975 | m3 := mload(0x60) |
| 3976 | m4 := mload(0x80) |
| 3977 | m5 := mload(0xa0) |
| 3978 | m6 := mload(0xc0) |
| 3979 | // Selector of `log(address,bool,uint256,string)`. |
| 3980 | mstore(0x00, 0x0aa6cfad) |
| 3981 | mstore(0x20, p0) |
| 3982 | mstore(0x40, p1) |
| 3983 | mstore(0x60, p2) |
| 3984 | mstore(0x80, 0x80) |
| 3985 | writeString(0xa0, p3) |
| 3986 | } |
| 3987 | _sendLogPayload(0x1c, 0xc4); |
| 3988 | /// @solidity memory-safe-assembly |
| 3989 | assembly { |
| 3990 | mstore(0x00, m0) |
| 3991 | mstore(0x20, m1) |
| 3992 | mstore(0x40, m2) |
| 3993 | mstore(0x60, m3) |
| 3994 | mstore(0x80, m4) |
| 3995 | mstore(0xa0, m5) |
| 3996 | mstore(0xc0, m6) |
| 3997 | } |
| 3998 | } |
| 3999 | |
| 4000 | function log(address p0, bool p1, bytes32 p2, address p3) internal pure { |
| 4001 | bytes32 m0; |
| 4002 | bytes32 m1; |
| 4003 | bytes32 m2; |
| 4004 | bytes32 m3; |
| 4005 | bytes32 m4; |
| 4006 | bytes32 m5; |
| 4007 | bytes32 m6; |
| 4008 | /// @solidity memory-safe-assembly |
| 4009 | assembly { |
| 4010 | function writeString(pos, w) { |
| 4011 | let length := 0 |
| 4012 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 4013 | mstore(pos, length) |
| 4014 | let shift := sub(256, shl(3, length)) |
| 4015 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 4016 | } |
| 4017 | m0 := mload(0x00) |
| 4018 | m1 := mload(0x20) |
| 4019 | m2 := mload(0x40) |
| 4020 | m3 := mload(0x60) |
| 4021 | m4 := mload(0x80) |
| 4022 | m5 := mload(0xa0) |
| 4023 | m6 := mload(0xc0) |
| 4024 | // Selector of `log(address,bool,string,address)`. |
| 4025 | mstore(0x00, 0x19fd4956) |
| 4026 | mstore(0x20, p0) |
| 4027 | mstore(0x40, p1) |
| 4028 | mstore(0x60, 0x80) |
| 4029 | mstore(0x80, p3) |
| 4030 | writeString(0xa0, p2) |
| 4031 | } |
| 4032 | _sendLogPayload(0x1c, 0xc4); |
| 4033 | /// @solidity memory-safe-assembly |
| 4034 | assembly { |
| 4035 | mstore(0x00, m0) |
| 4036 | mstore(0x20, m1) |
| 4037 | mstore(0x40, m2) |
| 4038 | mstore(0x60, m3) |
| 4039 | mstore(0x80, m4) |
| 4040 | mstore(0xa0, m5) |
| 4041 | mstore(0xc0, m6) |
| 4042 | } |
| 4043 | } |
| 4044 | |
| 4045 | function log(address p0, bool p1, bytes32 p2, bool p3) internal pure { |
| 4046 | bytes32 m0; |
| 4047 | bytes32 m1; |
| 4048 | bytes32 m2; |
| 4049 | bytes32 m3; |
| 4050 | bytes32 m4; |
| 4051 | bytes32 m5; |
| 4052 | bytes32 m6; |
| 4053 | /// @solidity memory-safe-assembly |
| 4054 | assembly { |
| 4055 | function writeString(pos, w) { |
| 4056 | let length := 0 |
| 4057 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 4058 | mstore(pos, length) |
| 4059 | let shift := sub(256, shl(3, length)) |
| 4060 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 4061 | } |
| 4062 | m0 := mload(0x00) |
| 4063 | m1 := mload(0x20) |
| 4064 | m2 := mload(0x40) |
| 4065 | m3 := mload(0x60) |
| 4066 | m4 := mload(0x80) |
| 4067 | m5 := mload(0xa0) |
| 4068 | m6 := mload(0xc0) |
| 4069 | // Selector of `log(address,bool,string,bool)`. |
| 4070 | mstore(0x00, 0x50ad461d) |
| 4071 | mstore(0x20, p0) |
| 4072 | mstore(0x40, p1) |
| 4073 | mstore(0x60, 0x80) |
| 4074 | mstore(0x80, p3) |
| 4075 | writeString(0xa0, p2) |
| 4076 | } |
| 4077 | _sendLogPayload(0x1c, 0xc4); |
| 4078 | /// @solidity memory-safe-assembly |
| 4079 | assembly { |
| 4080 | mstore(0x00, m0) |
| 4081 | mstore(0x20, m1) |
| 4082 | mstore(0x40, m2) |
| 4083 | mstore(0x60, m3) |
| 4084 | mstore(0x80, m4) |
| 4085 | mstore(0xa0, m5) |
| 4086 | mstore(0xc0, m6) |
| 4087 | } |
| 4088 | } |
| 4089 | |
| 4090 | function log(address p0, bool p1, bytes32 p2, uint256 p3) internal pure { |
| 4091 | bytes32 m0; |
| 4092 | bytes32 m1; |
| 4093 | bytes32 m2; |
| 4094 | bytes32 m3; |
| 4095 | bytes32 m4; |
| 4096 | bytes32 m5; |
| 4097 | bytes32 m6; |
| 4098 | /// @solidity memory-safe-assembly |
| 4099 | assembly { |
| 4100 | function writeString(pos, w) { |
| 4101 | let length := 0 |
| 4102 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 4103 | mstore(pos, length) |
| 4104 | let shift := sub(256, shl(3, length)) |
| 4105 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 4106 | } |
| 4107 | m0 := mload(0x00) |
| 4108 | m1 := mload(0x20) |
| 4109 | m2 := mload(0x40) |
| 4110 | m3 := mload(0x60) |
| 4111 | m4 := mload(0x80) |
| 4112 | m5 := mload(0xa0) |
| 4113 | m6 := mload(0xc0) |
| 4114 | // Selector of `log(address,bool,string,uint256)`. |
| 4115 | mstore(0x00, 0x80e6a20b) |
| 4116 | mstore(0x20, p0) |
| 4117 | mstore(0x40, p1) |
| 4118 | mstore(0x60, 0x80) |
| 4119 | mstore(0x80, p3) |
| 4120 | writeString(0xa0, p2) |
| 4121 | } |
| 4122 | _sendLogPayload(0x1c, 0xc4); |
| 4123 | /// @solidity memory-safe-assembly |
| 4124 | assembly { |
| 4125 | mstore(0x00, m0) |
| 4126 | mstore(0x20, m1) |
| 4127 | mstore(0x40, m2) |
| 4128 | mstore(0x60, m3) |
| 4129 | mstore(0x80, m4) |
| 4130 | mstore(0xa0, m5) |
| 4131 | mstore(0xc0, m6) |
| 4132 | } |
| 4133 | } |
| 4134 | |
| 4135 | function log(address p0, bool p1, bytes32 p2, bytes32 p3) internal pure { |
| 4136 | bytes32 m0; |
| 4137 | bytes32 m1; |
| 4138 | bytes32 m2; |
| 4139 | bytes32 m3; |
| 4140 | bytes32 m4; |
| 4141 | bytes32 m5; |
| 4142 | bytes32 m6; |
| 4143 | bytes32 m7; |
| 4144 | bytes32 m8; |
| 4145 | /// @solidity memory-safe-assembly |
| 4146 | assembly { |
| 4147 | function writeString(pos, w) { |
| 4148 | let length := 0 |
| 4149 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 4150 | mstore(pos, length) |
| 4151 | let shift := sub(256, shl(3, length)) |
| 4152 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 4153 | } |
| 4154 | m0 := mload(0x00) |
| 4155 | m1 := mload(0x20) |
| 4156 | m2 := mload(0x40) |
| 4157 | m3 := mload(0x60) |
| 4158 | m4 := mload(0x80) |
| 4159 | m5 := mload(0xa0) |
| 4160 | m6 := mload(0xc0) |
| 4161 | m7 := mload(0xe0) |
| 4162 | m8 := mload(0x100) |
| 4163 | // Selector of `log(address,bool,string,string)`. |
| 4164 | mstore(0x00, 0x475c5c33) |
| 4165 | mstore(0x20, p0) |
| 4166 | mstore(0x40, p1) |
| 4167 | mstore(0x60, 0x80) |
| 4168 | mstore(0x80, 0xc0) |
| 4169 | writeString(0xa0, p2) |
| 4170 | writeString(0xe0, p3) |
| 4171 | } |
| 4172 | _sendLogPayload(0x1c, 0x104); |
| 4173 | /// @solidity memory-safe-assembly |
| 4174 | assembly { |
| 4175 | mstore(0x00, m0) |
| 4176 | mstore(0x20, m1) |
| 4177 | mstore(0x40, m2) |
| 4178 | mstore(0x60, m3) |
| 4179 | mstore(0x80, m4) |
| 4180 | mstore(0xa0, m5) |
| 4181 | mstore(0xc0, m6) |
| 4182 | mstore(0xe0, m7) |
| 4183 | mstore(0x100, m8) |
| 4184 | } |
| 4185 | } |
| 4186 | |
| 4187 | function log(address p0, uint256 p1, address p2, address p3) internal pure { |
| 4188 | bytes32 m0; |
| 4189 | bytes32 m1; |
| 4190 | bytes32 m2; |
| 4191 | bytes32 m3; |
| 4192 | bytes32 m4; |
| 4193 | /// @solidity memory-safe-assembly |
| 4194 | assembly { |
| 4195 | m0 := mload(0x00) |
| 4196 | m1 := mload(0x20) |
| 4197 | m2 := mload(0x40) |
| 4198 | m3 := mload(0x60) |
| 4199 | m4 := mload(0x80) |
| 4200 | // Selector of `log(address,uint256,address,address)`. |
| 4201 | mstore(0x00, 0x478d1c62) |
| 4202 | mstore(0x20, p0) |
| 4203 | mstore(0x40, p1) |
| 4204 | mstore(0x60, p2) |
| 4205 | mstore(0x80, p3) |
| 4206 | } |
| 4207 | _sendLogPayload(0x1c, 0x84); |
| 4208 | /// @solidity memory-safe-assembly |
| 4209 | assembly { |
| 4210 | mstore(0x00, m0) |
| 4211 | mstore(0x20, m1) |
| 4212 | mstore(0x40, m2) |
| 4213 | mstore(0x60, m3) |
| 4214 | mstore(0x80, m4) |
| 4215 | } |
| 4216 | } |
| 4217 | |
| 4218 | function log(address p0, uint256 p1, address p2, bool p3) internal pure { |
| 4219 | bytes32 m0; |
| 4220 | bytes32 m1; |
| 4221 | bytes32 m2; |
| 4222 | bytes32 m3; |
| 4223 | bytes32 m4; |
| 4224 | /// @solidity memory-safe-assembly |
| 4225 | assembly { |
| 4226 | m0 := mload(0x00) |
| 4227 | m1 := mload(0x20) |
| 4228 | m2 := mload(0x40) |
| 4229 | m3 := mload(0x60) |
| 4230 | m4 := mload(0x80) |
| 4231 | // Selector of `log(address,uint256,address,bool)`. |
| 4232 | mstore(0x00, 0xa1bcc9b3) |
| 4233 | mstore(0x20, p0) |
| 4234 | mstore(0x40, p1) |
| 4235 | mstore(0x60, p2) |
| 4236 | mstore(0x80, p3) |
| 4237 | } |
| 4238 | _sendLogPayload(0x1c, 0x84); |
| 4239 | /// @solidity memory-safe-assembly |
| 4240 | assembly { |
| 4241 | mstore(0x00, m0) |
| 4242 | mstore(0x20, m1) |
| 4243 | mstore(0x40, m2) |
| 4244 | mstore(0x60, m3) |
| 4245 | mstore(0x80, m4) |
| 4246 | } |
| 4247 | } |
| 4248 | |
| 4249 | function log(address p0, uint256 p1, address p2, uint256 p3) internal pure { |
| 4250 | bytes32 m0; |
| 4251 | bytes32 m1; |
| 4252 | bytes32 m2; |
| 4253 | bytes32 m3; |
| 4254 | bytes32 m4; |
| 4255 | /// @solidity memory-safe-assembly |
| 4256 | assembly { |
| 4257 | m0 := mload(0x00) |
| 4258 | m1 := mload(0x20) |
| 4259 | m2 := mload(0x40) |
| 4260 | m3 := mload(0x60) |
| 4261 | m4 := mload(0x80) |
| 4262 | // Selector of `log(address,uint256,address,uint256)`. |
| 4263 | mstore(0x00, 0x100f650e) |
| 4264 | mstore(0x20, p0) |
| 4265 | mstore(0x40, p1) |
| 4266 | mstore(0x60, p2) |
| 4267 | mstore(0x80, p3) |
| 4268 | } |
| 4269 | _sendLogPayload(0x1c, 0x84); |
| 4270 | /// @solidity memory-safe-assembly |
| 4271 | assembly { |
| 4272 | mstore(0x00, m0) |
| 4273 | mstore(0x20, m1) |
| 4274 | mstore(0x40, m2) |
| 4275 | mstore(0x60, m3) |
| 4276 | mstore(0x80, m4) |
| 4277 | } |
| 4278 | } |
| 4279 | |
| 4280 | function log(address p0, uint256 p1, address p2, bytes32 p3) internal pure { |
| 4281 | bytes32 m0; |
| 4282 | bytes32 m1; |
| 4283 | bytes32 m2; |
| 4284 | bytes32 m3; |
| 4285 | bytes32 m4; |
| 4286 | bytes32 m5; |
| 4287 | bytes32 m6; |
| 4288 | /// @solidity memory-safe-assembly |
| 4289 | assembly { |
| 4290 | function writeString(pos, w) { |
| 4291 | let length := 0 |
| 4292 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 4293 | mstore(pos, length) |
| 4294 | let shift := sub(256, shl(3, length)) |
| 4295 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 4296 | } |
| 4297 | m0 := mload(0x00) |
| 4298 | m1 := mload(0x20) |
| 4299 | m2 := mload(0x40) |
| 4300 | m3 := mload(0x60) |
| 4301 | m4 := mload(0x80) |
| 4302 | m5 := mload(0xa0) |
| 4303 | m6 := mload(0xc0) |
| 4304 | // Selector of `log(address,uint256,address,string)`. |
| 4305 | mstore(0x00, 0x1da986ea) |
| 4306 | mstore(0x20, p0) |
| 4307 | mstore(0x40, p1) |
| 4308 | mstore(0x60, p2) |
| 4309 | mstore(0x80, 0x80) |
| 4310 | writeString(0xa0, p3) |
| 4311 | } |
| 4312 | _sendLogPayload(0x1c, 0xc4); |
| 4313 | /// @solidity memory-safe-assembly |
| 4314 | assembly { |
| 4315 | mstore(0x00, m0) |
| 4316 | mstore(0x20, m1) |
| 4317 | mstore(0x40, m2) |
| 4318 | mstore(0x60, m3) |
| 4319 | mstore(0x80, m4) |
| 4320 | mstore(0xa0, m5) |
| 4321 | mstore(0xc0, m6) |
| 4322 | } |
| 4323 | } |
| 4324 | |
| 4325 | function log(address p0, uint256 p1, bool p2, address p3) internal pure { |
| 4326 | bytes32 m0; |
| 4327 | bytes32 m1; |
| 4328 | bytes32 m2; |
| 4329 | bytes32 m3; |
| 4330 | bytes32 m4; |
| 4331 | /// @solidity memory-safe-assembly |
| 4332 | assembly { |
| 4333 | m0 := mload(0x00) |
| 4334 | m1 := mload(0x20) |
| 4335 | m2 := mload(0x40) |
| 4336 | m3 := mload(0x60) |
| 4337 | m4 := mload(0x80) |
| 4338 | // Selector of `log(address,uint256,bool,address)`. |
| 4339 | mstore(0x00, 0xa31bfdcc) |
| 4340 | mstore(0x20, p0) |
| 4341 | mstore(0x40, p1) |
| 4342 | mstore(0x60, p2) |
| 4343 | mstore(0x80, p3) |
| 4344 | } |
| 4345 | _sendLogPayload(0x1c, 0x84); |
| 4346 | /// @solidity memory-safe-assembly |
| 4347 | assembly { |
| 4348 | mstore(0x00, m0) |
| 4349 | mstore(0x20, m1) |
| 4350 | mstore(0x40, m2) |
| 4351 | mstore(0x60, m3) |
| 4352 | mstore(0x80, m4) |
| 4353 | } |
| 4354 | } |
| 4355 | |
| 4356 | function log(address p0, uint256 p1, bool p2, bool p3) internal pure { |
| 4357 | bytes32 m0; |
| 4358 | bytes32 m1; |
| 4359 | bytes32 m2; |
| 4360 | bytes32 m3; |
| 4361 | bytes32 m4; |
| 4362 | /// @solidity memory-safe-assembly |
| 4363 | assembly { |
| 4364 | m0 := mload(0x00) |
| 4365 | m1 := mload(0x20) |
| 4366 | m2 := mload(0x40) |
| 4367 | m3 := mload(0x60) |
| 4368 | m4 := mload(0x80) |
| 4369 | // Selector of `log(address,uint256,bool,bool)`. |
| 4370 | mstore(0x00, 0x3bf5e537) |
| 4371 | mstore(0x20, p0) |
| 4372 | mstore(0x40, p1) |
| 4373 | mstore(0x60, p2) |
| 4374 | mstore(0x80, p3) |
| 4375 | } |
| 4376 | _sendLogPayload(0x1c, 0x84); |
| 4377 | /// @solidity memory-safe-assembly |
| 4378 | assembly { |
| 4379 | mstore(0x00, m0) |
| 4380 | mstore(0x20, m1) |
| 4381 | mstore(0x40, m2) |
| 4382 | mstore(0x60, m3) |
| 4383 | mstore(0x80, m4) |
| 4384 | } |
| 4385 | } |
| 4386 | |
| 4387 | function log(address p0, uint256 p1, bool p2, uint256 p3) internal pure { |
| 4388 | bytes32 m0; |
| 4389 | bytes32 m1; |
| 4390 | bytes32 m2; |
| 4391 | bytes32 m3; |
| 4392 | bytes32 m4; |
| 4393 | /// @solidity memory-safe-assembly |
| 4394 | assembly { |
| 4395 | m0 := mload(0x00) |
| 4396 | m1 := mload(0x20) |
| 4397 | m2 := mload(0x40) |
| 4398 | m3 := mload(0x60) |
| 4399 | m4 := mload(0x80) |
| 4400 | // Selector of `log(address,uint256,bool,uint256)`. |
| 4401 | mstore(0x00, 0x22f6b999) |
| 4402 | mstore(0x20, p0) |
| 4403 | mstore(0x40, p1) |
| 4404 | mstore(0x60, p2) |
| 4405 | mstore(0x80, p3) |
| 4406 | } |
| 4407 | _sendLogPayload(0x1c, 0x84); |
| 4408 | /// @solidity memory-safe-assembly |
| 4409 | assembly { |
| 4410 | mstore(0x00, m0) |
| 4411 | mstore(0x20, m1) |
| 4412 | mstore(0x40, m2) |
| 4413 | mstore(0x60, m3) |
| 4414 | mstore(0x80, m4) |
| 4415 | } |
| 4416 | } |
| 4417 | |
| 4418 | function log(address p0, uint256 p1, bool p2, bytes32 p3) internal pure { |
| 4419 | bytes32 m0; |
| 4420 | bytes32 m1; |
| 4421 | bytes32 m2; |
| 4422 | bytes32 m3; |
| 4423 | bytes32 m4; |
| 4424 | bytes32 m5; |
| 4425 | bytes32 m6; |
| 4426 | /// @solidity memory-safe-assembly |
| 4427 | assembly { |
| 4428 | function writeString(pos, w) { |
| 4429 | let length := 0 |
| 4430 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 4431 | mstore(pos, length) |
| 4432 | let shift := sub(256, shl(3, length)) |
| 4433 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 4434 | } |
| 4435 | m0 := mload(0x00) |
| 4436 | m1 := mload(0x20) |
| 4437 | m2 := mload(0x40) |
| 4438 | m3 := mload(0x60) |
| 4439 | m4 := mload(0x80) |
| 4440 | m5 := mload(0xa0) |
| 4441 | m6 := mload(0xc0) |
| 4442 | // Selector of `log(address,uint256,bool,string)`. |
| 4443 | mstore(0x00, 0xc5ad85f9) |
| 4444 | mstore(0x20, p0) |
| 4445 | mstore(0x40, p1) |
| 4446 | mstore(0x60, p2) |
| 4447 | mstore(0x80, 0x80) |
| 4448 | writeString(0xa0, p3) |
| 4449 | } |
| 4450 | _sendLogPayload(0x1c, 0xc4); |
| 4451 | /// @solidity memory-safe-assembly |
| 4452 | assembly { |
| 4453 | mstore(0x00, m0) |
| 4454 | mstore(0x20, m1) |
| 4455 | mstore(0x40, m2) |
| 4456 | mstore(0x60, m3) |
| 4457 | mstore(0x80, m4) |
| 4458 | mstore(0xa0, m5) |
| 4459 | mstore(0xc0, m6) |
| 4460 | } |
| 4461 | } |
| 4462 | |
| 4463 | function log(address p0, uint256 p1, uint256 p2, address p3) internal pure { |
| 4464 | bytes32 m0; |
| 4465 | bytes32 m1; |
| 4466 | bytes32 m2; |
| 4467 | bytes32 m3; |
| 4468 | bytes32 m4; |
| 4469 | /// @solidity memory-safe-assembly |
| 4470 | assembly { |
| 4471 | m0 := mload(0x00) |
| 4472 | m1 := mload(0x20) |
| 4473 | m2 := mload(0x40) |
| 4474 | m3 := mload(0x60) |
| 4475 | m4 := mload(0x80) |
| 4476 | // Selector of `log(address,uint256,uint256,address)`. |
| 4477 | mstore(0x00, 0x20e3984d) |
| 4478 | mstore(0x20, p0) |
| 4479 | mstore(0x40, p1) |
| 4480 | mstore(0x60, p2) |
| 4481 | mstore(0x80, p3) |
| 4482 | } |
| 4483 | _sendLogPayload(0x1c, 0x84); |
| 4484 | /// @solidity memory-safe-assembly |
| 4485 | assembly { |
| 4486 | mstore(0x00, m0) |
| 4487 | mstore(0x20, m1) |
| 4488 | mstore(0x40, m2) |
| 4489 | mstore(0x60, m3) |
| 4490 | mstore(0x80, m4) |
| 4491 | } |
| 4492 | } |
| 4493 | |
| 4494 | function log(address p0, uint256 p1, uint256 p2, bool p3) internal pure { |
| 4495 | bytes32 m0; |
| 4496 | bytes32 m1; |
| 4497 | bytes32 m2; |
| 4498 | bytes32 m3; |
| 4499 | bytes32 m4; |
| 4500 | /// @solidity memory-safe-assembly |
| 4501 | assembly { |
| 4502 | m0 := mload(0x00) |
| 4503 | m1 := mload(0x20) |
| 4504 | m2 := mload(0x40) |
| 4505 | m3 := mload(0x60) |
| 4506 | m4 := mload(0x80) |
| 4507 | // Selector of `log(address,uint256,uint256,bool)`. |
| 4508 | mstore(0x00, 0x66f1bc67) |
| 4509 | mstore(0x20, p0) |
| 4510 | mstore(0x40, p1) |
| 4511 | mstore(0x60, p2) |
| 4512 | mstore(0x80, p3) |
| 4513 | } |
| 4514 | _sendLogPayload(0x1c, 0x84); |
| 4515 | /// @solidity memory-safe-assembly |
| 4516 | assembly { |
| 4517 | mstore(0x00, m0) |
| 4518 | mstore(0x20, m1) |
| 4519 | mstore(0x40, m2) |
| 4520 | mstore(0x60, m3) |
| 4521 | mstore(0x80, m4) |
| 4522 | } |
| 4523 | } |
| 4524 | |
| 4525 | function log(address p0, uint256 p1, uint256 p2, uint256 p3) internal pure { |
| 4526 | bytes32 m0; |
| 4527 | bytes32 m1; |
| 4528 | bytes32 m2; |
| 4529 | bytes32 m3; |
| 4530 | bytes32 m4; |
| 4531 | /// @solidity memory-safe-assembly |
| 4532 | assembly { |
| 4533 | m0 := mload(0x00) |
| 4534 | m1 := mload(0x20) |
| 4535 | m2 := mload(0x40) |
| 4536 | m3 := mload(0x60) |
| 4537 | m4 := mload(0x80) |
| 4538 | // Selector of `log(address,uint256,uint256,uint256)`. |
| 4539 | mstore(0x00, 0x34f0e636) |
| 4540 | mstore(0x20, p0) |
| 4541 | mstore(0x40, p1) |
| 4542 | mstore(0x60, p2) |
| 4543 | mstore(0x80, p3) |
| 4544 | } |
| 4545 | _sendLogPayload(0x1c, 0x84); |
| 4546 | /// @solidity memory-safe-assembly |
| 4547 | assembly { |
| 4548 | mstore(0x00, m0) |
| 4549 | mstore(0x20, m1) |
| 4550 | mstore(0x40, m2) |
| 4551 | mstore(0x60, m3) |
| 4552 | mstore(0x80, m4) |
| 4553 | } |
| 4554 | } |
| 4555 | |
| 4556 | function log(address p0, uint256 p1, uint256 p2, bytes32 p3) internal pure { |
| 4557 | bytes32 m0; |
| 4558 | bytes32 m1; |
| 4559 | bytes32 m2; |
| 4560 | bytes32 m3; |
| 4561 | bytes32 m4; |
| 4562 | bytes32 m5; |
| 4563 | bytes32 m6; |
| 4564 | /// @solidity memory-safe-assembly |
| 4565 | assembly { |
| 4566 | function writeString(pos, w) { |
| 4567 | let length := 0 |
| 4568 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 4569 | mstore(pos, length) |
| 4570 | let shift := sub(256, shl(3, length)) |
| 4571 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 4572 | } |
| 4573 | m0 := mload(0x00) |
| 4574 | m1 := mload(0x20) |
| 4575 | m2 := mload(0x40) |
| 4576 | m3 := mload(0x60) |
| 4577 | m4 := mload(0x80) |
| 4578 | m5 := mload(0xa0) |
| 4579 | m6 := mload(0xc0) |
| 4580 | // Selector of `log(address,uint256,uint256,string)`. |
| 4581 | mstore(0x00, 0x4a28c017) |
| 4582 | mstore(0x20, p0) |
| 4583 | mstore(0x40, p1) |
| 4584 | mstore(0x60, p2) |
| 4585 | mstore(0x80, 0x80) |
| 4586 | writeString(0xa0, p3) |
| 4587 | } |
| 4588 | _sendLogPayload(0x1c, 0xc4); |
| 4589 | /// @solidity memory-safe-assembly |
| 4590 | assembly { |
| 4591 | mstore(0x00, m0) |
| 4592 | mstore(0x20, m1) |
| 4593 | mstore(0x40, m2) |
| 4594 | mstore(0x60, m3) |
| 4595 | mstore(0x80, m4) |
| 4596 | mstore(0xa0, m5) |
| 4597 | mstore(0xc0, m6) |
| 4598 | } |
| 4599 | } |
| 4600 | |
| 4601 | function log(address p0, uint256 p1, bytes32 p2, address p3) internal pure { |
| 4602 | bytes32 m0; |
| 4603 | bytes32 m1; |
| 4604 | bytes32 m2; |
| 4605 | bytes32 m3; |
| 4606 | bytes32 m4; |
| 4607 | bytes32 m5; |
| 4608 | bytes32 m6; |
| 4609 | /// @solidity memory-safe-assembly |
| 4610 | assembly { |
| 4611 | function writeString(pos, w) { |
| 4612 | let length := 0 |
| 4613 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 4614 | mstore(pos, length) |
| 4615 | let shift := sub(256, shl(3, length)) |
| 4616 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 4617 | } |
| 4618 | m0 := mload(0x00) |
| 4619 | m1 := mload(0x20) |
| 4620 | m2 := mload(0x40) |
| 4621 | m3 := mload(0x60) |
| 4622 | m4 := mload(0x80) |
| 4623 | m5 := mload(0xa0) |
| 4624 | m6 := mload(0xc0) |
| 4625 | // Selector of `log(address,uint256,string,address)`. |
| 4626 | mstore(0x00, 0x5c430d47) |
| 4627 | mstore(0x20, p0) |
| 4628 | mstore(0x40, p1) |
| 4629 | mstore(0x60, 0x80) |
| 4630 | mstore(0x80, p3) |
| 4631 | writeString(0xa0, p2) |
| 4632 | } |
| 4633 | _sendLogPayload(0x1c, 0xc4); |
| 4634 | /// @solidity memory-safe-assembly |
| 4635 | assembly { |
| 4636 | mstore(0x00, m0) |
| 4637 | mstore(0x20, m1) |
| 4638 | mstore(0x40, m2) |
| 4639 | mstore(0x60, m3) |
| 4640 | mstore(0x80, m4) |
| 4641 | mstore(0xa0, m5) |
| 4642 | mstore(0xc0, m6) |
| 4643 | } |
| 4644 | } |
| 4645 | |
| 4646 | function log(address p0, uint256 p1, bytes32 p2, bool p3) internal pure { |
| 4647 | bytes32 m0; |
| 4648 | bytes32 m1; |
| 4649 | bytes32 m2; |
| 4650 | bytes32 m3; |
| 4651 | bytes32 m4; |
| 4652 | bytes32 m5; |
| 4653 | bytes32 m6; |
| 4654 | /// @solidity memory-safe-assembly |
| 4655 | assembly { |
| 4656 | function writeString(pos, w) { |
| 4657 | let length := 0 |
| 4658 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 4659 | mstore(pos, length) |
| 4660 | let shift := sub(256, shl(3, length)) |
| 4661 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 4662 | } |
| 4663 | m0 := mload(0x00) |
| 4664 | m1 := mload(0x20) |
| 4665 | m2 := mload(0x40) |
| 4666 | m3 := mload(0x60) |
| 4667 | m4 := mload(0x80) |
| 4668 | m5 := mload(0xa0) |
| 4669 | m6 := mload(0xc0) |
| 4670 | // Selector of `log(address,uint256,string,bool)`. |
| 4671 | mstore(0x00, 0xcf18105c) |
| 4672 | mstore(0x20, p0) |
| 4673 | mstore(0x40, p1) |
| 4674 | mstore(0x60, 0x80) |
| 4675 | mstore(0x80, p3) |
| 4676 | writeString(0xa0, p2) |
| 4677 | } |
| 4678 | _sendLogPayload(0x1c, 0xc4); |
| 4679 | /// @solidity memory-safe-assembly |
| 4680 | assembly { |
| 4681 | mstore(0x00, m0) |
| 4682 | mstore(0x20, m1) |
| 4683 | mstore(0x40, m2) |
| 4684 | mstore(0x60, m3) |
| 4685 | mstore(0x80, m4) |
| 4686 | mstore(0xa0, m5) |
| 4687 | mstore(0xc0, m6) |
| 4688 | } |
| 4689 | } |
| 4690 | |
| 4691 | function log(address p0, uint256 p1, bytes32 p2, uint256 p3) internal pure { |
| 4692 | bytes32 m0; |
| 4693 | bytes32 m1; |
| 4694 | bytes32 m2; |
| 4695 | bytes32 m3; |
| 4696 | bytes32 m4; |
| 4697 | bytes32 m5; |
| 4698 | bytes32 m6; |
| 4699 | /// @solidity memory-safe-assembly |
| 4700 | assembly { |
| 4701 | function writeString(pos, w) { |
| 4702 | let length := 0 |
| 4703 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 4704 | mstore(pos, length) |
| 4705 | let shift := sub(256, shl(3, length)) |
| 4706 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 4707 | } |
| 4708 | m0 := mload(0x00) |
| 4709 | m1 := mload(0x20) |
| 4710 | m2 := mload(0x40) |
| 4711 | m3 := mload(0x60) |
| 4712 | m4 := mload(0x80) |
| 4713 | m5 := mload(0xa0) |
| 4714 | m6 := mload(0xc0) |
| 4715 | // Selector of `log(address,uint256,string,uint256)`. |
| 4716 | mstore(0x00, 0xbf01f891) |
| 4717 | mstore(0x20, p0) |
| 4718 | mstore(0x40, p1) |
| 4719 | mstore(0x60, 0x80) |
| 4720 | mstore(0x80, p3) |
| 4721 | writeString(0xa0, p2) |
| 4722 | } |
| 4723 | _sendLogPayload(0x1c, 0xc4); |
| 4724 | /// @solidity memory-safe-assembly |
| 4725 | assembly { |
| 4726 | mstore(0x00, m0) |
| 4727 | mstore(0x20, m1) |
| 4728 | mstore(0x40, m2) |
| 4729 | mstore(0x60, m3) |
| 4730 | mstore(0x80, m4) |
| 4731 | mstore(0xa0, m5) |
| 4732 | mstore(0xc0, m6) |
| 4733 | } |
| 4734 | } |
| 4735 | |
| 4736 | function log(address p0, uint256 p1, bytes32 p2, bytes32 p3) internal pure { |
| 4737 | bytes32 m0; |
| 4738 | bytes32 m1; |
| 4739 | bytes32 m2; |
| 4740 | bytes32 m3; |
| 4741 | bytes32 m4; |
| 4742 | bytes32 m5; |
| 4743 | bytes32 m6; |
| 4744 | bytes32 m7; |
| 4745 | bytes32 m8; |
| 4746 | /// @solidity memory-safe-assembly |
| 4747 | assembly { |
| 4748 | function writeString(pos, w) { |
| 4749 | let length := 0 |
| 4750 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 4751 | mstore(pos, length) |
| 4752 | let shift := sub(256, shl(3, length)) |
| 4753 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 4754 | } |
| 4755 | m0 := mload(0x00) |
| 4756 | m1 := mload(0x20) |
| 4757 | m2 := mload(0x40) |
| 4758 | m3 := mload(0x60) |
| 4759 | m4 := mload(0x80) |
| 4760 | m5 := mload(0xa0) |
| 4761 | m6 := mload(0xc0) |
| 4762 | m7 := mload(0xe0) |
| 4763 | m8 := mload(0x100) |
| 4764 | // Selector of `log(address,uint256,string,string)`. |
| 4765 | mstore(0x00, 0x88a8c406) |
| 4766 | mstore(0x20, p0) |
| 4767 | mstore(0x40, p1) |
| 4768 | mstore(0x60, 0x80) |
| 4769 | mstore(0x80, 0xc0) |
| 4770 | writeString(0xa0, p2) |
| 4771 | writeString(0xe0, p3) |
| 4772 | } |
| 4773 | _sendLogPayload(0x1c, 0x104); |
| 4774 | /// @solidity memory-safe-assembly |
| 4775 | assembly { |
| 4776 | mstore(0x00, m0) |
| 4777 | mstore(0x20, m1) |
| 4778 | mstore(0x40, m2) |
| 4779 | mstore(0x60, m3) |
| 4780 | mstore(0x80, m4) |
| 4781 | mstore(0xa0, m5) |
| 4782 | mstore(0xc0, m6) |
| 4783 | mstore(0xe0, m7) |
| 4784 | mstore(0x100, m8) |
| 4785 | } |
| 4786 | } |
| 4787 | |
| 4788 | function log(address p0, bytes32 p1, address p2, address p3) internal pure { |
| 4789 | bytes32 m0; |
| 4790 | bytes32 m1; |
| 4791 | bytes32 m2; |
| 4792 | bytes32 m3; |
| 4793 | bytes32 m4; |
| 4794 | bytes32 m5; |
| 4795 | bytes32 m6; |
| 4796 | /// @solidity memory-safe-assembly |
| 4797 | assembly { |
| 4798 | function writeString(pos, w) { |
| 4799 | let length := 0 |
| 4800 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 4801 | mstore(pos, length) |
| 4802 | let shift := sub(256, shl(3, length)) |
| 4803 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 4804 | } |
| 4805 | m0 := mload(0x00) |
| 4806 | m1 := mload(0x20) |
| 4807 | m2 := mload(0x40) |
| 4808 | m3 := mload(0x60) |
| 4809 | m4 := mload(0x80) |
| 4810 | m5 := mload(0xa0) |
| 4811 | m6 := mload(0xc0) |
| 4812 | // Selector of `log(address,string,address,address)`. |
| 4813 | mstore(0x00, 0x0d36fa20) |
| 4814 | mstore(0x20, p0) |
| 4815 | mstore(0x40, 0x80) |
| 4816 | mstore(0x60, p2) |
| 4817 | mstore(0x80, p3) |
| 4818 | writeString(0xa0, p1) |
| 4819 | } |
| 4820 | _sendLogPayload(0x1c, 0xc4); |
| 4821 | /// @solidity memory-safe-assembly |
| 4822 | assembly { |
| 4823 | mstore(0x00, m0) |
| 4824 | mstore(0x20, m1) |
| 4825 | mstore(0x40, m2) |
| 4826 | mstore(0x60, m3) |
| 4827 | mstore(0x80, m4) |
| 4828 | mstore(0xa0, m5) |
| 4829 | mstore(0xc0, m6) |
| 4830 | } |
| 4831 | } |
| 4832 | |
| 4833 | function log(address p0, bytes32 p1, address p2, bool p3) internal pure { |
| 4834 | bytes32 m0; |
| 4835 | bytes32 m1; |
| 4836 | bytes32 m2; |
| 4837 | bytes32 m3; |
| 4838 | bytes32 m4; |
| 4839 | bytes32 m5; |
| 4840 | bytes32 m6; |
| 4841 | /// @solidity memory-safe-assembly |
| 4842 | assembly { |
| 4843 | function writeString(pos, w) { |
| 4844 | let length := 0 |
| 4845 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 4846 | mstore(pos, length) |
| 4847 | let shift := sub(256, shl(3, length)) |
| 4848 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 4849 | } |
| 4850 | m0 := mload(0x00) |
| 4851 | m1 := mload(0x20) |
| 4852 | m2 := mload(0x40) |
| 4853 | m3 := mload(0x60) |
| 4854 | m4 := mload(0x80) |
| 4855 | m5 := mload(0xa0) |
| 4856 | m6 := mload(0xc0) |
| 4857 | // Selector of `log(address,string,address,bool)`. |
| 4858 | mstore(0x00, 0x0df12b76) |
| 4859 | mstore(0x20, p0) |
| 4860 | mstore(0x40, 0x80) |
| 4861 | mstore(0x60, p2) |
| 4862 | mstore(0x80, p3) |
| 4863 | writeString(0xa0, p1) |
| 4864 | } |
| 4865 | _sendLogPayload(0x1c, 0xc4); |
| 4866 | /// @solidity memory-safe-assembly |
| 4867 | assembly { |
| 4868 | mstore(0x00, m0) |
| 4869 | mstore(0x20, m1) |
| 4870 | mstore(0x40, m2) |
| 4871 | mstore(0x60, m3) |
| 4872 | mstore(0x80, m4) |
| 4873 | mstore(0xa0, m5) |
| 4874 | mstore(0xc0, m6) |
| 4875 | } |
| 4876 | } |
| 4877 | |
| 4878 | function log(address p0, bytes32 p1, address p2, uint256 p3) internal pure { |
| 4879 | bytes32 m0; |
| 4880 | bytes32 m1; |
| 4881 | bytes32 m2; |
| 4882 | bytes32 m3; |
| 4883 | bytes32 m4; |
| 4884 | bytes32 m5; |
| 4885 | bytes32 m6; |
| 4886 | /// @solidity memory-safe-assembly |
| 4887 | assembly { |
| 4888 | function writeString(pos, w) { |
| 4889 | let length := 0 |
| 4890 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 4891 | mstore(pos, length) |
| 4892 | let shift := sub(256, shl(3, length)) |
| 4893 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 4894 | } |
| 4895 | m0 := mload(0x00) |
| 4896 | m1 := mload(0x20) |
| 4897 | m2 := mload(0x40) |
| 4898 | m3 := mload(0x60) |
| 4899 | m4 := mload(0x80) |
| 4900 | m5 := mload(0xa0) |
| 4901 | m6 := mload(0xc0) |
| 4902 | // Selector of `log(address,string,address,uint256)`. |
| 4903 | mstore(0x00, 0x457fe3cf) |
| 4904 | mstore(0x20, p0) |
| 4905 | mstore(0x40, 0x80) |
| 4906 | mstore(0x60, p2) |
| 4907 | mstore(0x80, p3) |
| 4908 | writeString(0xa0, p1) |
| 4909 | } |
| 4910 | _sendLogPayload(0x1c, 0xc4); |
| 4911 | /// @solidity memory-safe-assembly |
| 4912 | assembly { |
| 4913 | mstore(0x00, m0) |
| 4914 | mstore(0x20, m1) |
| 4915 | mstore(0x40, m2) |
| 4916 | mstore(0x60, m3) |
| 4917 | mstore(0x80, m4) |
| 4918 | mstore(0xa0, m5) |
| 4919 | mstore(0xc0, m6) |
| 4920 | } |
| 4921 | } |
| 4922 | |
| 4923 | function log(address p0, bytes32 p1, address p2, bytes32 p3) internal pure { |
| 4924 | bytes32 m0; |
| 4925 | bytes32 m1; |
| 4926 | bytes32 m2; |
| 4927 | bytes32 m3; |
| 4928 | bytes32 m4; |
| 4929 | bytes32 m5; |
| 4930 | bytes32 m6; |
| 4931 | bytes32 m7; |
| 4932 | bytes32 m8; |
| 4933 | /// @solidity memory-safe-assembly |
| 4934 | assembly { |
| 4935 | function writeString(pos, w) { |
| 4936 | let length := 0 |
| 4937 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 4938 | mstore(pos, length) |
| 4939 | let shift := sub(256, shl(3, length)) |
| 4940 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 4941 | } |
| 4942 | m0 := mload(0x00) |
| 4943 | m1 := mload(0x20) |
| 4944 | m2 := mload(0x40) |
| 4945 | m3 := mload(0x60) |
| 4946 | m4 := mload(0x80) |
| 4947 | m5 := mload(0xa0) |
| 4948 | m6 := mload(0xc0) |
| 4949 | m7 := mload(0xe0) |
| 4950 | m8 := mload(0x100) |
| 4951 | // Selector of `log(address,string,address,string)`. |
| 4952 | mstore(0x00, 0xf7e36245) |
| 4953 | mstore(0x20, p0) |
| 4954 | mstore(0x40, 0x80) |
| 4955 | mstore(0x60, p2) |
| 4956 | mstore(0x80, 0xc0) |
| 4957 | writeString(0xa0, p1) |
| 4958 | writeString(0xe0, p3) |
| 4959 | } |
| 4960 | _sendLogPayload(0x1c, 0x104); |
| 4961 | /// @solidity memory-safe-assembly |
| 4962 | assembly { |
| 4963 | mstore(0x00, m0) |
| 4964 | mstore(0x20, m1) |
| 4965 | mstore(0x40, m2) |
| 4966 | mstore(0x60, m3) |
| 4967 | mstore(0x80, m4) |
| 4968 | mstore(0xa0, m5) |
| 4969 | mstore(0xc0, m6) |
| 4970 | mstore(0xe0, m7) |
| 4971 | mstore(0x100, m8) |
| 4972 | } |
| 4973 | } |
| 4974 | |
| 4975 | function log(address p0, bytes32 p1, bool p2, address p3) internal pure { |
| 4976 | bytes32 m0; |
| 4977 | bytes32 m1; |
| 4978 | bytes32 m2; |
| 4979 | bytes32 m3; |
| 4980 | bytes32 m4; |
| 4981 | bytes32 m5; |
| 4982 | bytes32 m6; |
| 4983 | /// @solidity memory-safe-assembly |
| 4984 | assembly { |
| 4985 | function writeString(pos, w) { |
| 4986 | let length := 0 |
| 4987 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 4988 | mstore(pos, length) |
| 4989 | let shift := sub(256, shl(3, length)) |
| 4990 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 4991 | } |
| 4992 | m0 := mload(0x00) |
| 4993 | m1 := mload(0x20) |
| 4994 | m2 := mload(0x40) |
| 4995 | m3 := mload(0x60) |
| 4996 | m4 := mload(0x80) |
| 4997 | m5 := mload(0xa0) |
| 4998 | m6 := mload(0xc0) |
| 4999 | // Selector of `log(address,string,bool,address)`. |
| 5000 | mstore(0x00, 0x205871c2) |
| 5001 | mstore(0x20, p0) |
| 5002 | mstore(0x40, 0x80) |
| 5003 | mstore(0x60, p2) |
| 5004 | mstore(0x80, p3) |
| 5005 | writeString(0xa0, p1) |
| 5006 | } |
| 5007 | _sendLogPayload(0x1c, 0xc4); |
| 5008 | /// @solidity memory-safe-assembly |
| 5009 | assembly { |
| 5010 | mstore(0x00, m0) |
| 5011 | mstore(0x20, m1) |
| 5012 | mstore(0x40, m2) |
| 5013 | mstore(0x60, m3) |
| 5014 | mstore(0x80, m4) |
| 5015 | mstore(0xa0, m5) |
| 5016 | mstore(0xc0, m6) |
| 5017 | } |
| 5018 | } |
| 5019 | |
| 5020 | function log(address p0, bytes32 p1, bool p2, bool p3) internal pure { |
| 5021 | bytes32 m0; |
| 5022 | bytes32 m1; |
| 5023 | bytes32 m2; |
| 5024 | bytes32 m3; |
| 5025 | bytes32 m4; |
| 5026 | bytes32 m5; |
| 5027 | bytes32 m6; |
| 5028 | /// @solidity memory-safe-assembly |
| 5029 | assembly { |
| 5030 | function writeString(pos, w) { |
| 5031 | let length := 0 |
| 5032 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 5033 | mstore(pos, length) |
| 5034 | let shift := sub(256, shl(3, length)) |
| 5035 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 5036 | } |
| 5037 | m0 := mload(0x00) |
| 5038 | m1 := mload(0x20) |
| 5039 | m2 := mload(0x40) |
| 5040 | m3 := mload(0x60) |
| 5041 | m4 := mload(0x80) |
| 5042 | m5 := mload(0xa0) |
| 5043 | m6 := mload(0xc0) |
| 5044 | // Selector of `log(address,string,bool,bool)`. |
| 5045 | mstore(0x00, 0x5f1d5c9f) |
| 5046 | mstore(0x20, p0) |
| 5047 | mstore(0x40, 0x80) |
| 5048 | mstore(0x60, p2) |
| 5049 | mstore(0x80, p3) |
| 5050 | writeString(0xa0, p1) |
| 5051 | } |
| 5052 | _sendLogPayload(0x1c, 0xc4); |
| 5053 | /// @solidity memory-safe-assembly |
| 5054 | assembly { |
| 5055 | mstore(0x00, m0) |
| 5056 | mstore(0x20, m1) |
| 5057 | mstore(0x40, m2) |
| 5058 | mstore(0x60, m3) |
| 5059 | mstore(0x80, m4) |
| 5060 | mstore(0xa0, m5) |
| 5061 | mstore(0xc0, m6) |
| 5062 | } |
| 5063 | } |
| 5064 | |
| 5065 | function log(address p0, bytes32 p1, bool p2, uint256 p3) internal pure { |
| 5066 | bytes32 m0; |
| 5067 | bytes32 m1; |
| 5068 | bytes32 m2; |
| 5069 | bytes32 m3; |
| 5070 | bytes32 m4; |
| 5071 | bytes32 m5; |
| 5072 | bytes32 m6; |
| 5073 | /// @solidity memory-safe-assembly |
| 5074 | assembly { |
| 5075 | function writeString(pos, w) { |
| 5076 | let length := 0 |
| 5077 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 5078 | mstore(pos, length) |
| 5079 | let shift := sub(256, shl(3, length)) |
| 5080 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 5081 | } |
| 5082 | m0 := mload(0x00) |
| 5083 | m1 := mload(0x20) |
| 5084 | m2 := mload(0x40) |
| 5085 | m3 := mload(0x60) |
| 5086 | m4 := mload(0x80) |
| 5087 | m5 := mload(0xa0) |
| 5088 | m6 := mload(0xc0) |
| 5089 | // Selector of `log(address,string,bool,uint256)`. |
| 5090 | mstore(0x00, 0x515e38b6) |
| 5091 | mstore(0x20, p0) |
| 5092 | mstore(0x40, 0x80) |
| 5093 | mstore(0x60, p2) |
| 5094 | mstore(0x80, p3) |
| 5095 | writeString(0xa0, p1) |
| 5096 | } |
| 5097 | _sendLogPayload(0x1c, 0xc4); |
| 5098 | /// @solidity memory-safe-assembly |
| 5099 | assembly { |
| 5100 | mstore(0x00, m0) |
| 5101 | mstore(0x20, m1) |
| 5102 | mstore(0x40, m2) |
| 5103 | mstore(0x60, m3) |
| 5104 | mstore(0x80, m4) |
| 5105 | mstore(0xa0, m5) |
| 5106 | mstore(0xc0, m6) |
| 5107 | } |
| 5108 | } |
| 5109 | |
| 5110 | function log(address p0, bytes32 p1, bool p2, bytes32 p3) internal pure { |
| 5111 | bytes32 m0; |
| 5112 | bytes32 m1; |
| 5113 | bytes32 m2; |
| 5114 | bytes32 m3; |
| 5115 | bytes32 m4; |
| 5116 | bytes32 m5; |
| 5117 | bytes32 m6; |
| 5118 | bytes32 m7; |
| 5119 | bytes32 m8; |
| 5120 | /// @solidity memory-safe-assembly |
| 5121 | assembly { |
| 5122 | function writeString(pos, w) { |
| 5123 | let length := 0 |
| 5124 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 5125 | mstore(pos, length) |
| 5126 | let shift := sub(256, shl(3, length)) |
| 5127 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 5128 | } |
| 5129 | m0 := mload(0x00) |
| 5130 | m1 := mload(0x20) |
| 5131 | m2 := mload(0x40) |
| 5132 | m3 := mload(0x60) |
| 5133 | m4 := mload(0x80) |
| 5134 | m5 := mload(0xa0) |
| 5135 | m6 := mload(0xc0) |
| 5136 | m7 := mload(0xe0) |
| 5137 | m8 := mload(0x100) |
| 5138 | // Selector of `log(address,string,bool,string)`. |
| 5139 | mstore(0x00, 0xbc0b61fe) |
| 5140 | mstore(0x20, p0) |
| 5141 | mstore(0x40, 0x80) |
| 5142 | mstore(0x60, p2) |
| 5143 | mstore(0x80, 0xc0) |
| 5144 | writeString(0xa0, p1) |
| 5145 | writeString(0xe0, p3) |
| 5146 | } |
| 5147 | _sendLogPayload(0x1c, 0x104); |
| 5148 | /// @solidity memory-safe-assembly |
| 5149 | assembly { |
| 5150 | mstore(0x00, m0) |
| 5151 | mstore(0x20, m1) |
| 5152 | mstore(0x40, m2) |
| 5153 | mstore(0x60, m3) |
| 5154 | mstore(0x80, m4) |
| 5155 | mstore(0xa0, m5) |
| 5156 | mstore(0xc0, m6) |
| 5157 | mstore(0xe0, m7) |
| 5158 | mstore(0x100, m8) |
| 5159 | } |
| 5160 | } |
| 5161 | |
| 5162 | function log(address p0, bytes32 p1, uint256 p2, address p3) internal pure { |
| 5163 | bytes32 m0; |
| 5164 | bytes32 m1; |
| 5165 | bytes32 m2; |
| 5166 | bytes32 m3; |
| 5167 | bytes32 m4; |
| 5168 | bytes32 m5; |
| 5169 | bytes32 m6; |
| 5170 | /// @solidity memory-safe-assembly |
| 5171 | assembly { |
| 5172 | function writeString(pos, w) { |
| 5173 | let length := 0 |
| 5174 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 5175 | mstore(pos, length) |
| 5176 | let shift := sub(256, shl(3, length)) |
| 5177 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 5178 | } |
| 5179 | m0 := mload(0x00) |
| 5180 | m1 := mload(0x20) |
| 5181 | m2 := mload(0x40) |
| 5182 | m3 := mload(0x60) |
| 5183 | m4 := mload(0x80) |
| 5184 | m5 := mload(0xa0) |
| 5185 | m6 := mload(0xc0) |
| 5186 | // Selector of `log(address,string,uint256,address)`. |
| 5187 | mstore(0x00, 0x63183678) |
| 5188 | mstore(0x20, p0) |
| 5189 | mstore(0x40, 0x80) |
| 5190 | mstore(0x60, p2) |
| 5191 | mstore(0x80, p3) |
| 5192 | writeString(0xa0, p1) |
| 5193 | } |
| 5194 | _sendLogPayload(0x1c, 0xc4); |
| 5195 | /// @solidity memory-safe-assembly |
| 5196 | assembly { |
| 5197 | mstore(0x00, m0) |
| 5198 | mstore(0x20, m1) |
| 5199 | mstore(0x40, m2) |
| 5200 | mstore(0x60, m3) |
| 5201 | mstore(0x80, m4) |
| 5202 | mstore(0xa0, m5) |
| 5203 | mstore(0xc0, m6) |
| 5204 | } |
| 5205 | } |
| 5206 | |
| 5207 | function log(address p0, bytes32 p1, uint256 p2, bool p3) internal pure { |
| 5208 | bytes32 m0; |
| 5209 | bytes32 m1; |
| 5210 | bytes32 m2; |
| 5211 | bytes32 m3; |
| 5212 | bytes32 m4; |
| 5213 | bytes32 m5; |
| 5214 | bytes32 m6; |
| 5215 | /// @solidity memory-safe-assembly |
| 5216 | assembly { |
| 5217 | function writeString(pos, w) { |
| 5218 | let length := 0 |
| 5219 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 5220 | mstore(pos, length) |
| 5221 | let shift := sub(256, shl(3, length)) |
| 5222 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 5223 | } |
| 5224 | m0 := mload(0x00) |
| 5225 | m1 := mload(0x20) |
| 5226 | m2 := mload(0x40) |
| 5227 | m3 := mload(0x60) |
| 5228 | m4 := mload(0x80) |
| 5229 | m5 := mload(0xa0) |
| 5230 | m6 := mload(0xc0) |
| 5231 | // Selector of `log(address,string,uint256,bool)`. |
| 5232 | mstore(0x00, 0x0ef7e050) |
| 5233 | mstore(0x20, p0) |
| 5234 | mstore(0x40, 0x80) |
| 5235 | mstore(0x60, p2) |
| 5236 | mstore(0x80, p3) |
| 5237 | writeString(0xa0, p1) |
| 5238 | } |
| 5239 | _sendLogPayload(0x1c, 0xc4); |
| 5240 | /// @solidity memory-safe-assembly |
| 5241 | assembly { |
| 5242 | mstore(0x00, m0) |
| 5243 | mstore(0x20, m1) |
| 5244 | mstore(0x40, m2) |
| 5245 | mstore(0x60, m3) |
| 5246 | mstore(0x80, m4) |
| 5247 | mstore(0xa0, m5) |
| 5248 | mstore(0xc0, m6) |
| 5249 | } |
| 5250 | } |
| 5251 | |
| 5252 | function log(address p0, bytes32 p1, uint256 p2, uint256 p3) internal pure { |
| 5253 | bytes32 m0; |
| 5254 | bytes32 m1; |
| 5255 | bytes32 m2; |
| 5256 | bytes32 m3; |
| 5257 | bytes32 m4; |
| 5258 | bytes32 m5; |
| 5259 | bytes32 m6; |
| 5260 | /// @solidity memory-safe-assembly |
| 5261 | assembly { |
| 5262 | function writeString(pos, w) { |
| 5263 | let length := 0 |
| 5264 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 5265 | mstore(pos, length) |
| 5266 | let shift := sub(256, shl(3, length)) |
| 5267 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 5268 | } |
| 5269 | m0 := mload(0x00) |
| 5270 | m1 := mload(0x20) |
| 5271 | m2 := mload(0x40) |
| 5272 | m3 := mload(0x60) |
| 5273 | m4 := mload(0x80) |
| 5274 | m5 := mload(0xa0) |
| 5275 | m6 := mload(0xc0) |
| 5276 | // Selector of `log(address,string,uint256,uint256)`. |
| 5277 | mstore(0x00, 0x1dc8e1b8) |
| 5278 | mstore(0x20, p0) |
| 5279 | mstore(0x40, 0x80) |
| 5280 | mstore(0x60, p2) |
| 5281 | mstore(0x80, p3) |
| 5282 | writeString(0xa0, p1) |
| 5283 | } |
| 5284 | _sendLogPayload(0x1c, 0xc4); |
| 5285 | /// @solidity memory-safe-assembly |
| 5286 | assembly { |
| 5287 | mstore(0x00, m0) |
| 5288 | mstore(0x20, m1) |
| 5289 | mstore(0x40, m2) |
| 5290 | mstore(0x60, m3) |
| 5291 | mstore(0x80, m4) |
| 5292 | mstore(0xa0, m5) |
| 5293 | mstore(0xc0, m6) |
| 5294 | } |
| 5295 | } |
| 5296 | |
| 5297 | function log(address p0, bytes32 p1, uint256 p2, bytes32 p3) internal pure { |
| 5298 | bytes32 m0; |
| 5299 | bytes32 m1; |
| 5300 | bytes32 m2; |
| 5301 | bytes32 m3; |
| 5302 | bytes32 m4; |
| 5303 | bytes32 m5; |
| 5304 | bytes32 m6; |
| 5305 | bytes32 m7; |
| 5306 | bytes32 m8; |
| 5307 | /// @solidity memory-safe-assembly |
| 5308 | assembly { |
| 5309 | function writeString(pos, w) { |
| 5310 | let length := 0 |
| 5311 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 5312 | mstore(pos, length) |
| 5313 | let shift := sub(256, shl(3, length)) |
| 5314 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 5315 | } |
| 5316 | m0 := mload(0x00) |
| 5317 | m1 := mload(0x20) |
| 5318 | m2 := mload(0x40) |
| 5319 | m3 := mload(0x60) |
| 5320 | m4 := mload(0x80) |
| 5321 | m5 := mload(0xa0) |
| 5322 | m6 := mload(0xc0) |
| 5323 | m7 := mload(0xe0) |
| 5324 | m8 := mload(0x100) |
| 5325 | // Selector of `log(address,string,uint256,string)`. |
| 5326 | mstore(0x00, 0x448830a8) |
| 5327 | mstore(0x20, p0) |
| 5328 | mstore(0x40, 0x80) |
| 5329 | mstore(0x60, p2) |
| 5330 | mstore(0x80, 0xc0) |
| 5331 | writeString(0xa0, p1) |
| 5332 | writeString(0xe0, p3) |
| 5333 | } |
| 5334 | _sendLogPayload(0x1c, 0x104); |
| 5335 | /// @solidity memory-safe-assembly |
| 5336 | assembly { |
| 5337 | mstore(0x00, m0) |
| 5338 | mstore(0x20, m1) |
| 5339 | mstore(0x40, m2) |
| 5340 | mstore(0x60, m3) |
| 5341 | mstore(0x80, m4) |
| 5342 | mstore(0xa0, m5) |
| 5343 | mstore(0xc0, m6) |
| 5344 | mstore(0xe0, m7) |
| 5345 | mstore(0x100, m8) |
| 5346 | } |
| 5347 | } |
| 5348 | |
| 5349 | function log(address p0, bytes32 p1, bytes32 p2, address p3) internal pure { |
| 5350 | bytes32 m0; |
| 5351 | bytes32 m1; |
| 5352 | bytes32 m2; |
| 5353 | bytes32 m3; |
| 5354 | bytes32 m4; |
| 5355 | bytes32 m5; |
| 5356 | bytes32 m6; |
| 5357 | bytes32 m7; |
| 5358 | bytes32 m8; |
| 5359 | /// @solidity memory-safe-assembly |
| 5360 | assembly { |
| 5361 | function writeString(pos, w) { |
| 5362 | let length := 0 |
| 5363 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 5364 | mstore(pos, length) |
| 5365 | let shift := sub(256, shl(3, length)) |
| 5366 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 5367 | } |
| 5368 | m0 := mload(0x00) |
| 5369 | m1 := mload(0x20) |
| 5370 | m2 := mload(0x40) |
| 5371 | m3 := mload(0x60) |
| 5372 | m4 := mload(0x80) |
| 5373 | m5 := mload(0xa0) |
| 5374 | m6 := mload(0xc0) |
| 5375 | m7 := mload(0xe0) |
| 5376 | m8 := mload(0x100) |
| 5377 | // Selector of `log(address,string,string,address)`. |
| 5378 | mstore(0x00, 0xa04e2f87) |
| 5379 | mstore(0x20, p0) |
| 5380 | mstore(0x40, 0x80) |
| 5381 | mstore(0x60, 0xc0) |
| 5382 | mstore(0x80, p3) |
| 5383 | writeString(0xa0, p1) |
| 5384 | writeString(0xe0, p2) |
| 5385 | } |
| 5386 | _sendLogPayload(0x1c, 0x104); |
| 5387 | /// @solidity memory-safe-assembly |
| 5388 | assembly { |
| 5389 | mstore(0x00, m0) |
| 5390 | mstore(0x20, m1) |
| 5391 | mstore(0x40, m2) |
| 5392 | mstore(0x60, m3) |
| 5393 | mstore(0x80, m4) |
| 5394 | mstore(0xa0, m5) |
| 5395 | mstore(0xc0, m6) |
| 5396 | mstore(0xe0, m7) |
| 5397 | mstore(0x100, m8) |
| 5398 | } |
| 5399 | } |
| 5400 | |
| 5401 | function log(address p0, bytes32 p1, bytes32 p2, bool p3) internal pure { |
| 5402 | bytes32 m0; |
| 5403 | bytes32 m1; |
| 5404 | bytes32 m2; |
| 5405 | bytes32 m3; |
| 5406 | bytes32 m4; |
| 5407 | bytes32 m5; |
| 5408 | bytes32 m6; |
| 5409 | bytes32 m7; |
| 5410 | bytes32 m8; |
| 5411 | /// @solidity memory-safe-assembly |
| 5412 | assembly { |
| 5413 | function writeString(pos, w) { |
| 5414 | let length := 0 |
| 5415 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 5416 | mstore(pos, length) |
| 5417 | let shift := sub(256, shl(3, length)) |
| 5418 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 5419 | } |
| 5420 | m0 := mload(0x00) |
| 5421 | m1 := mload(0x20) |
| 5422 | m2 := mload(0x40) |
| 5423 | m3 := mload(0x60) |
| 5424 | m4 := mload(0x80) |
| 5425 | m5 := mload(0xa0) |
| 5426 | m6 := mload(0xc0) |
| 5427 | m7 := mload(0xe0) |
| 5428 | m8 := mload(0x100) |
| 5429 | // Selector of `log(address,string,string,bool)`. |
| 5430 | mstore(0x00, 0x35a5071f) |
| 5431 | mstore(0x20, p0) |
| 5432 | mstore(0x40, 0x80) |
| 5433 | mstore(0x60, 0xc0) |
| 5434 | mstore(0x80, p3) |
| 5435 | writeString(0xa0, p1) |
| 5436 | writeString(0xe0, p2) |
| 5437 | } |
| 5438 | _sendLogPayload(0x1c, 0x104); |
| 5439 | /// @solidity memory-safe-assembly |
| 5440 | assembly { |
| 5441 | mstore(0x00, m0) |
| 5442 | mstore(0x20, m1) |
| 5443 | mstore(0x40, m2) |
| 5444 | mstore(0x60, m3) |
| 5445 | mstore(0x80, m4) |
| 5446 | mstore(0xa0, m5) |
| 5447 | mstore(0xc0, m6) |
| 5448 | mstore(0xe0, m7) |
| 5449 | mstore(0x100, m8) |
| 5450 | } |
| 5451 | } |
| 5452 | |
| 5453 | function log(address p0, bytes32 p1, bytes32 p2, uint256 p3) internal pure { |
| 5454 | bytes32 m0; |
| 5455 | bytes32 m1; |
| 5456 | bytes32 m2; |
| 5457 | bytes32 m3; |
| 5458 | bytes32 m4; |
| 5459 | bytes32 m5; |
| 5460 | bytes32 m6; |
| 5461 | bytes32 m7; |
| 5462 | bytes32 m8; |
| 5463 | /// @solidity memory-safe-assembly |
| 5464 | assembly { |
| 5465 | function writeString(pos, w) { |
| 5466 | let length := 0 |
| 5467 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 5468 | mstore(pos, length) |
| 5469 | let shift := sub(256, shl(3, length)) |
| 5470 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 5471 | } |
| 5472 | m0 := mload(0x00) |
| 5473 | m1 := mload(0x20) |
| 5474 | m2 := mload(0x40) |
| 5475 | m3 := mload(0x60) |
| 5476 | m4 := mload(0x80) |
| 5477 | m5 := mload(0xa0) |
| 5478 | m6 := mload(0xc0) |
| 5479 | m7 := mload(0xe0) |
| 5480 | m8 := mload(0x100) |
| 5481 | // Selector of `log(address,string,string,uint256)`. |
| 5482 | mstore(0x00, 0x159f8927) |
| 5483 | mstore(0x20, p0) |
| 5484 | mstore(0x40, 0x80) |
| 5485 | mstore(0x60, 0xc0) |
| 5486 | mstore(0x80, p3) |
| 5487 | writeString(0xa0, p1) |
| 5488 | writeString(0xe0, p2) |
| 5489 | } |
| 5490 | _sendLogPayload(0x1c, 0x104); |
| 5491 | /// @solidity memory-safe-assembly |
| 5492 | assembly { |
| 5493 | mstore(0x00, m0) |
| 5494 | mstore(0x20, m1) |
| 5495 | mstore(0x40, m2) |
| 5496 | mstore(0x60, m3) |
| 5497 | mstore(0x80, m4) |
| 5498 | mstore(0xa0, m5) |
| 5499 | mstore(0xc0, m6) |
| 5500 | mstore(0xe0, m7) |
| 5501 | mstore(0x100, m8) |
| 5502 | } |
| 5503 | } |
| 5504 | |
| 5505 | function log(address p0, bytes32 p1, bytes32 p2, bytes32 p3) internal pure { |
| 5506 | bytes32 m0; |
| 5507 | bytes32 m1; |
| 5508 | bytes32 m2; |
| 5509 | bytes32 m3; |
| 5510 | bytes32 m4; |
| 5511 | bytes32 m5; |
| 5512 | bytes32 m6; |
| 5513 | bytes32 m7; |
| 5514 | bytes32 m8; |
| 5515 | bytes32 m9; |
| 5516 | bytes32 m10; |
| 5517 | /// @solidity memory-safe-assembly |
| 5518 | assembly { |
| 5519 | function writeString(pos, w) { |
| 5520 | let length := 0 |
| 5521 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 5522 | mstore(pos, length) |
| 5523 | let shift := sub(256, shl(3, length)) |
| 5524 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 5525 | } |
| 5526 | m0 := mload(0x00) |
| 5527 | m1 := mload(0x20) |
| 5528 | m2 := mload(0x40) |
| 5529 | m3 := mload(0x60) |
| 5530 | m4 := mload(0x80) |
| 5531 | m5 := mload(0xa0) |
| 5532 | m6 := mload(0xc0) |
| 5533 | m7 := mload(0xe0) |
| 5534 | m8 := mload(0x100) |
| 5535 | m9 := mload(0x120) |
| 5536 | m10 := mload(0x140) |
| 5537 | // Selector of `log(address,string,string,string)`. |
| 5538 | mstore(0x00, 0x5d02c50b) |
| 5539 | mstore(0x20, p0) |
| 5540 | mstore(0x40, 0x80) |
| 5541 | mstore(0x60, 0xc0) |
| 5542 | mstore(0x80, 0x100) |
| 5543 | writeString(0xa0, p1) |
| 5544 | writeString(0xe0, p2) |
| 5545 | writeString(0x120, p3) |
| 5546 | } |
| 5547 | _sendLogPayload(0x1c, 0x144); |
| 5548 | /// @solidity memory-safe-assembly |
| 5549 | assembly { |
| 5550 | mstore(0x00, m0) |
| 5551 | mstore(0x20, m1) |
| 5552 | mstore(0x40, m2) |
| 5553 | mstore(0x60, m3) |
| 5554 | mstore(0x80, m4) |
| 5555 | mstore(0xa0, m5) |
| 5556 | mstore(0xc0, m6) |
| 5557 | mstore(0xe0, m7) |
| 5558 | mstore(0x100, m8) |
| 5559 | mstore(0x120, m9) |
| 5560 | mstore(0x140, m10) |
| 5561 | } |
| 5562 | } |
| 5563 | |
| 5564 | function log(bool p0, address p1, address p2, address p3) internal pure { |
| 5565 | bytes32 m0; |
| 5566 | bytes32 m1; |
| 5567 | bytes32 m2; |
| 5568 | bytes32 m3; |
| 5569 | bytes32 m4; |
| 5570 | /// @solidity memory-safe-assembly |
| 5571 | assembly { |
| 5572 | m0 := mload(0x00) |
| 5573 | m1 := mload(0x20) |
| 5574 | m2 := mload(0x40) |
| 5575 | m3 := mload(0x60) |
| 5576 | m4 := mload(0x80) |
| 5577 | // Selector of `log(bool,address,address,address)`. |
| 5578 | mstore(0x00, 0x1d14d001) |
| 5579 | mstore(0x20, p0) |
| 5580 | mstore(0x40, p1) |
| 5581 | mstore(0x60, p2) |
| 5582 | mstore(0x80, p3) |
| 5583 | } |
| 5584 | _sendLogPayload(0x1c, 0x84); |
| 5585 | /// @solidity memory-safe-assembly |
| 5586 | assembly { |
| 5587 | mstore(0x00, m0) |
| 5588 | mstore(0x20, m1) |
| 5589 | mstore(0x40, m2) |
| 5590 | mstore(0x60, m3) |
| 5591 | mstore(0x80, m4) |
| 5592 | } |
| 5593 | } |
| 5594 | |
| 5595 | function log(bool p0, address p1, address p2, bool p3) internal pure { |
| 5596 | bytes32 m0; |
| 5597 | bytes32 m1; |
| 5598 | bytes32 m2; |
| 5599 | bytes32 m3; |
| 5600 | bytes32 m4; |
| 5601 | /// @solidity memory-safe-assembly |
| 5602 | assembly { |
| 5603 | m0 := mload(0x00) |
| 5604 | m1 := mload(0x20) |
| 5605 | m2 := mload(0x40) |
| 5606 | m3 := mload(0x60) |
| 5607 | m4 := mload(0x80) |
| 5608 | // Selector of `log(bool,address,address,bool)`. |
| 5609 | mstore(0x00, 0x46600be0) |
| 5610 | mstore(0x20, p0) |
| 5611 | mstore(0x40, p1) |
| 5612 | mstore(0x60, p2) |
| 5613 | mstore(0x80, p3) |
| 5614 | } |
| 5615 | _sendLogPayload(0x1c, 0x84); |
| 5616 | /// @solidity memory-safe-assembly |
| 5617 | assembly { |
| 5618 | mstore(0x00, m0) |
| 5619 | mstore(0x20, m1) |
| 5620 | mstore(0x40, m2) |
| 5621 | mstore(0x60, m3) |
| 5622 | mstore(0x80, m4) |
| 5623 | } |
| 5624 | } |
| 5625 | |
| 5626 | function log(bool p0, address p1, address p2, uint256 p3) internal pure { |
| 5627 | bytes32 m0; |
| 5628 | bytes32 m1; |
| 5629 | bytes32 m2; |
| 5630 | bytes32 m3; |
| 5631 | bytes32 m4; |
| 5632 | /// @solidity memory-safe-assembly |
| 5633 | assembly { |
| 5634 | m0 := mload(0x00) |
| 5635 | m1 := mload(0x20) |
| 5636 | m2 := mload(0x40) |
| 5637 | m3 := mload(0x60) |
| 5638 | m4 := mload(0x80) |
| 5639 | // Selector of `log(bool,address,address,uint256)`. |
| 5640 | mstore(0x00, 0x0c66d1be) |
| 5641 | mstore(0x20, p0) |
| 5642 | mstore(0x40, p1) |
| 5643 | mstore(0x60, p2) |
| 5644 | mstore(0x80, p3) |
| 5645 | } |
| 5646 | _sendLogPayload(0x1c, 0x84); |
| 5647 | /// @solidity memory-safe-assembly |
| 5648 | assembly { |
| 5649 | mstore(0x00, m0) |
| 5650 | mstore(0x20, m1) |
| 5651 | mstore(0x40, m2) |
| 5652 | mstore(0x60, m3) |
| 5653 | mstore(0x80, m4) |
| 5654 | } |
| 5655 | } |
| 5656 | |
| 5657 | function log(bool p0, address p1, address p2, bytes32 p3) internal pure { |
| 5658 | bytes32 m0; |
| 5659 | bytes32 m1; |
| 5660 | bytes32 m2; |
| 5661 | bytes32 m3; |
| 5662 | bytes32 m4; |
| 5663 | bytes32 m5; |
| 5664 | bytes32 m6; |
| 5665 | /// @solidity memory-safe-assembly |
| 5666 | assembly { |
| 5667 | function writeString(pos, w) { |
| 5668 | let length := 0 |
| 5669 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 5670 | mstore(pos, length) |
| 5671 | let shift := sub(256, shl(3, length)) |
| 5672 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 5673 | } |
| 5674 | m0 := mload(0x00) |
| 5675 | m1 := mload(0x20) |
| 5676 | m2 := mload(0x40) |
| 5677 | m3 := mload(0x60) |
| 5678 | m4 := mload(0x80) |
| 5679 | m5 := mload(0xa0) |
| 5680 | m6 := mload(0xc0) |
| 5681 | // Selector of `log(bool,address,address,string)`. |
| 5682 | mstore(0x00, 0xd812a167) |
| 5683 | mstore(0x20, p0) |
| 5684 | mstore(0x40, p1) |
| 5685 | mstore(0x60, p2) |
| 5686 | mstore(0x80, 0x80) |
| 5687 | writeString(0xa0, p3) |
| 5688 | } |
| 5689 | _sendLogPayload(0x1c, 0xc4); |
| 5690 | /// @solidity memory-safe-assembly |
| 5691 | assembly { |
| 5692 | mstore(0x00, m0) |
| 5693 | mstore(0x20, m1) |
| 5694 | mstore(0x40, m2) |
| 5695 | mstore(0x60, m3) |
| 5696 | mstore(0x80, m4) |
| 5697 | mstore(0xa0, m5) |
| 5698 | mstore(0xc0, m6) |
| 5699 | } |
| 5700 | } |
| 5701 | |
| 5702 | function log(bool p0, address p1, bool p2, address p3) internal pure { |
| 5703 | bytes32 m0; |
| 5704 | bytes32 m1; |
| 5705 | bytes32 m2; |
| 5706 | bytes32 m3; |
| 5707 | bytes32 m4; |
| 5708 | /// @solidity memory-safe-assembly |
| 5709 | assembly { |
| 5710 | m0 := mload(0x00) |
| 5711 | m1 := mload(0x20) |
| 5712 | m2 := mload(0x40) |
| 5713 | m3 := mload(0x60) |
| 5714 | m4 := mload(0x80) |
| 5715 | // Selector of `log(bool,address,bool,address)`. |
| 5716 | mstore(0x00, 0x1c41a336) |
| 5717 | mstore(0x20, p0) |
| 5718 | mstore(0x40, p1) |
| 5719 | mstore(0x60, p2) |
| 5720 | mstore(0x80, p3) |
| 5721 | } |
| 5722 | _sendLogPayload(0x1c, 0x84); |
| 5723 | /// @solidity memory-safe-assembly |
| 5724 | assembly { |
| 5725 | mstore(0x00, m0) |
| 5726 | mstore(0x20, m1) |
| 5727 | mstore(0x40, m2) |
| 5728 | mstore(0x60, m3) |
| 5729 | mstore(0x80, m4) |
| 5730 | } |
| 5731 | } |
| 5732 | |
| 5733 | function log(bool p0, address p1, bool p2, bool p3) internal pure { |
| 5734 | bytes32 m0; |
| 5735 | bytes32 m1; |
| 5736 | bytes32 m2; |
| 5737 | bytes32 m3; |
| 5738 | bytes32 m4; |
| 5739 | /// @solidity memory-safe-assembly |
| 5740 | assembly { |
| 5741 | m0 := mload(0x00) |
| 5742 | m1 := mload(0x20) |
| 5743 | m2 := mload(0x40) |
| 5744 | m3 := mload(0x60) |
| 5745 | m4 := mload(0x80) |
| 5746 | // Selector of `log(bool,address,bool,bool)`. |
| 5747 | mstore(0x00, 0x6a9c478b) |
| 5748 | mstore(0x20, p0) |
| 5749 | mstore(0x40, p1) |
| 5750 | mstore(0x60, p2) |
| 5751 | mstore(0x80, p3) |
| 5752 | } |
| 5753 | _sendLogPayload(0x1c, 0x84); |
| 5754 | /// @solidity memory-safe-assembly |
| 5755 | assembly { |
| 5756 | mstore(0x00, m0) |
| 5757 | mstore(0x20, m1) |
| 5758 | mstore(0x40, m2) |
| 5759 | mstore(0x60, m3) |
| 5760 | mstore(0x80, m4) |
| 5761 | } |
| 5762 | } |
| 5763 | |
| 5764 | function log(bool p0, address p1, bool p2, uint256 p3) internal pure { |
| 5765 | bytes32 m0; |
| 5766 | bytes32 m1; |
| 5767 | bytes32 m2; |
| 5768 | bytes32 m3; |
| 5769 | bytes32 m4; |
| 5770 | /// @solidity memory-safe-assembly |
| 5771 | assembly { |
| 5772 | m0 := mload(0x00) |
| 5773 | m1 := mload(0x20) |
| 5774 | m2 := mload(0x40) |
| 5775 | m3 := mload(0x60) |
| 5776 | m4 := mload(0x80) |
| 5777 | // Selector of `log(bool,address,bool,uint256)`. |
| 5778 | mstore(0x00, 0x07831502) |
| 5779 | mstore(0x20, p0) |
| 5780 | mstore(0x40, p1) |
| 5781 | mstore(0x60, p2) |
| 5782 | mstore(0x80, p3) |
| 5783 | } |
| 5784 | _sendLogPayload(0x1c, 0x84); |
| 5785 | /// @solidity memory-safe-assembly |
| 5786 | assembly { |
| 5787 | mstore(0x00, m0) |
| 5788 | mstore(0x20, m1) |
| 5789 | mstore(0x40, m2) |
| 5790 | mstore(0x60, m3) |
| 5791 | mstore(0x80, m4) |
| 5792 | } |
| 5793 | } |
| 5794 | |
| 5795 | function log(bool p0, address p1, bool p2, bytes32 p3) internal pure { |
| 5796 | bytes32 m0; |
| 5797 | bytes32 m1; |
| 5798 | bytes32 m2; |
| 5799 | bytes32 m3; |
| 5800 | bytes32 m4; |
| 5801 | bytes32 m5; |
| 5802 | bytes32 m6; |
| 5803 | /// @solidity memory-safe-assembly |
| 5804 | assembly { |
| 5805 | function writeString(pos, w) { |
| 5806 | let length := 0 |
| 5807 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 5808 | mstore(pos, length) |
| 5809 | let shift := sub(256, shl(3, length)) |
| 5810 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 5811 | } |
| 5812 | m0 := mload(0x00) |
| 5813 | m1 := mload(0x20) |
| 5814 | m2 := mload(0x40) |
| 5815 | m3 := mload(0x60) |
| 5816 | m4 := mload(0x80) |
| 5817 | m5 := mload(0xa0) |
| 5818 | m6 := mload(0xc0) |
| 5819 | // Selector of `log(bool,address,bool,string)`. |
| 5820 | mstore(0x00, 0x4a66cb34) |
| 5821 | mstore(0x20, p0) |
| 5822 | mstore(0x40, p1) |
| 5823 | mstore(0x60, p2) |
| 5824 | mstore(0x80, 0x80) |
| 5825 | writeString(0xa0, p3) |
| 5826 | } |
| 5827 | _sendLogPayload(0x1c, 0xc4); |
| 5828 | /// @solidity memory-safe-assembly |
| 5829 | assembly { |
| 5830 | mstore(0x00, m0) |
| 5831 | mstore(0x20, m1) |
| 5832 | mstore(0x40, m2) |
| 5833 | mstore(0x60, m3) |
| 5834 | mstore(0x80, m4) |
| 5835 | mstore(0xa0, m5) |
| 5836 | mstore(0xc0, m6) |
| 5837 | } |
| 5838 | } |
| 5839 | |
| 5840 | function log(bool p0, address p1, uint256 p2, address p3) internal pure { |
| 5841 | bytes32 m0; |
| 5842 | bytes32 m1; |
| 5843 | bytes32 m2; |
| 5844 | bytes32 m3; |
| 5845 | bytes32 m4; |
| 5846 | /// @solidity memory-safe-assembly |
| 5847 | assembly { |
| 5848 | m0 := mload(0x00) |
| 5849 | m1 := mload(0x20) |
| 5850 | m2 := mload(0x40) |
| 5851 | m3 := mload(0x60) |
| 5852 | m4 := mload(0x80) |
| 5853 | // Selector of `log(bool,address,uint256,address)`. |
| 5854 | mstore(0x00, 0x136b05dd) |
| 5855 | mstore(0x20, p0) |
| 5856 | mstore(0x40, p1) |
| 5857 | mstore(0x60, p2) |
| 5858 | mstore(0x80, p3) |
| 5859 | } |
| 5860 | _sendLogPayload(0x1c, 0x84); |
| 5861 | /// @solidity memory-safe-assembly |
| 5862 | assembly { |
| 5863 | mstore(0x00, m0) |
| 5864 | mstore(0x20, m1) |
| 5865 | mstore(0x40, m2) |
| 5866 | mstore(0x60, m3) |
| 5867 | mstore(0x80, m4) |
| 5868 | } |
| 5869 | } |
| 5870 | |
| 5871 | function log(bool p0, address p1, uint256 p2, bool p3) internal pure { |
| 5872 | bytes32 m0; |
| 5873 | bytes32 m1; |
| 5874 | bytes32 m2; |
| 5875 | bytes32 m3; |
| 5876 | bytes32 m4; |
| 5877 | /// @solidity memory-safe-assembly |
| 5878 | assembly { |
| 5879 | m0 := mload(0x00) |
| 5880 | m1 := mload(0x20) |
| 5881 | m2 := mload(0x40) |
| 5882 | m3 := mload(0x60) |
| 5883 | m4 := mload(0x80) |
| 5884 | // Selector of `log(bool,address,uint256,bool)`. |
| 5885 | mstore(0x00, 0xd6019f1c) |
| 5886 | mstore(0x20, p0) |
| 5887 | mstore(0x40, p1) |
| 5888 | mstore(0x60, p2) |
| 5889 | mstore(0x80, p3) |
| 5890 | } |
| 5891 | _sendLogPayload(0x1c, 0x84); |
| 5892 | /// @solidity memory-safe-assembly |
| 5893 | assembly { |
| 5894 | mstore(0x00, m0) |
| 5895 | mstore(0x20, m1) |
| 5896 | mstore(0x40, m2) |
| 5897 | mstore(0x60, m3) |
| 5898 | mstore(0x80, m4) |
| 5899 | } |
| 5900 | } |
| 5901 | |
| 5902 | function log(bool p0, address p1, uint256 p2, uint256 p3) internal pure { |
| 5903 | bytes32 m0; |
| 5904 | bytes32 m1; |
| 5905 | bytes32 m2; |
| 5906 | bytes32 m3; |
| 5907 | bytes32 m4; |
| 5908 | /// @solidity memory-safe-assembly |
| 5909 | assembly { |
| 5910 | m0 := mload(0x00) |
| 5911 | m1 := mload(0x20) |
| 5912 | m2 := mload(0x40) |
| 5913 | m3 := mload(0x60) |
| 5914 | m4 := mload(0x80) |
| 5915 | // Selector of `log(bool,address,uint256,uint256)`. |
| 5916 | mstore(0x00, 0x7bf181a1) |
| 5917 | mstore(0x20, p0) |
| 5918 | mstore(0x40, p1) |
| 5919 | mstore(0x60, p2) |
| 5920 | mstore(0x80, p3) |
| 5921 | } |
| 5922 | _sendLogPayload(0x1c, 0x84); |
| 5923 | /// @solidity memory-safe-assembly |
| 5924 | assembly { |
| 5925 | mstore(0x00, m0) |
| 5926 | mstore(0x20, m1) |
| 5927 | mstore(0x40, m2) |
| 5928 | mstore(0x60, m3) |
| 5929 | mstore(0x80, m4) |
| 5930 | } |
| 5931 | } |
| 5932 | |
| 5933 | function log(bool p0, address p1, uint256 p2, bytes32 p3) internal pure { |
| 5934 | bytes32 m0; |
| 5935 | bytes32 m1; |
| 5936 | bytes32 m2; |
| 5937 | bytes32 m3; |
| 5938 | bytes32 m4; |
| 5939 | bytes32 m5; |
| 5940 | bytes32 m6; |
| 5941 | /// @solidity memory-safe-assembly |
| 5942 | assembly { |
| 5943 | function writeString(pos, w) { |
| 5944 | let length := 0 |
| 5945 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 5946 | mstore(pos, length) |
| 5947 | let shift := sub(256, shl(3, length)) |
| 5948 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 5949 | } |
| 5950 | m0 := mload(0x00) |
| 5951 | m1 := mload(0x20) |
| 5952 | m2 := mload(0x40) |
| 5953 | m3 := mload(0x60) |
| 5954 | m4 := mload(0x80) |
| 5955 | m5 := mload(0xa0) |
| 5956 | m6 := mload(0xc0) |
| 5957 | // Selector of `log(bool,address,uint256,string)`. |
| 5958 | mstore(0x00, 0x51f09ff8) |
| 5959 | mstore(0x20, p0) |
| 5960 | mstore(0x40, p1) |
| 5961 | mstore(0x60, p2) |
| 5962 | mstore(0x80, 0x80) |
| 5963 | writeString(0xa0, p3) |
| 5964 | } |
| 5965 | _sendLogPayload(0x1c, 0xc4); |
| 5966 | /// @solidity memory-safe-assembly |
| 5967 | assembly { |
| 5968 | mstore(0x00, m0) |
| 5969 | mstore(0x20, m1) |
| 5970 | mstore(0x40, m2) |
| 5971 | mstore(0x60, m3) |
| 5972 | mstore(0x80, m4) |
| 5973 | mstore(0xa0, m5) |
| 5974 | mstore(0xc0, m6) |
| 5975 | } |
| 5976 | } |
| 5977 | |
| 5978 | function log(bool p0, address p1, bytes32 p2, address p3) internal pure { |
| 5979 | bytes32 m0; |
| 5980 | bytes32 m1; |
| 5981 | bytes32 m2; |
| 5982 | bytes32 m3; |
| 5983 | bytes32 m4; |
| 5984 | bytes32 m5; |
| 5985 | bytes32 m6; |
| 5986 | /// @solidity memory-safe-assembly |
| 5987 | assembly { |
| 5988 | function writeString(pos, w) { |
| 5989 | let length := 0 |
| 5990 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 5991 | mstore(pos, length) |
| 5992 | let shift := sub(256, shl(3, length)) |
| 5993 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 5994 | } |
| 5995 | m0 := mload(0x00) |
| 5996 | m1 := mload(0x20) |
| 5997 | m2 := mload(0x40) |
| 5998 | m3 := mload(0x60) |
| 5999 | m4 := mload(0x80) |
| 6000 | m5 := mload(0xa0) |
| 6001 | m6 := mload(0xc0) |
| 6002 | // Selector of `log(bool,address,string,address)`. |
| 6003 | mstore(0x00, 0x6f7c603e) |
| 6004 | mstore(0x20, p0) |
| 6005 | mstore(0x40, p1) |
| 6006 | mstore(0x60, 0x80) |
| 6007 | mstore(0x80, p3) |
| 6008 | writeString(0xa0, p2) |
| 6009 | } |
| 6010 | _sendLogPayload(0x1c, 0xc4); |
| 6011 | /// @solidity memory-safe-assembly |
| 6012 | assembly { |
| 6013 | mstore(0x00, m0) |
| 6014 | mstore(0x20, m1) |
| 6015 | mstore(0x40, m2) |
| 6016 | mstore(0x60, m3) |
| 6017 | mstore(0x80, m4) |
| 6018 | mstore(0xa0, m5) |
| 6019 | mstore(0xc0, m6) |
| 6020 | } |
| 6021 | } |
| 6022 | |
| 6023 | function log(bool p0, address p1, bytes32 p2, bool p3) internal pure { |
| 6024 | bytes32 m0; |
| 6025 | bytes32 m1; |
| 6026 | bytes32 m2; |
| 6027 | bytes32 m3; |
| 6028 | bytes32 m4; |
| 6029 | bytes32 m5; |
| 6030 | bytes32 m6; |
| 6031 | /// @solidity memory-safe-assembly |
| 6032 | assembly { |
| 6033 | function writeString(pos, w) { |
| 6034 | let length := 0 |
| 6035 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 6036 | mstore(pos, length) |
| 6037 | let shift := sub(256, shl(3, length)) |
| 6038 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 6039 | } |
| 6040 | m0 := mload(0x00) |
| 6041 | m1 := mload(0x20) |
| 6042 | m2 := mload(0x40) |
| 6043 | m3 := mload(0x60) |
| 6044 | m4 := mload(0x80) |
| 6045 | m5 := mload(0xa0) |
| 6046 | m6 := mload(0xc0) |
| 6047 | // Selector of `log(bool,address,string,bool)`. |
| 6048 | mstore(0x00, 0xe2bfd60b) |
| 6049 | mstore(0x20, p0) |
| 6050 | mstore(0x40, p1) |
| 6051 | mstore(0x60, 0x80) |
| 6052 | mstore(0x80, p3) |
| 6053 | writeString(0xa0, p2) |
| 6054 | } |
| 6055 | _sendLogPayload(0x1c, 0xc4); |
| 6056 | /// @solidity memory-safe-assembly |
| 6057 | assembly { |
| 6058 | mstore(0x00, m0) |
| 6059 | mstore(0x20, m1) |
| 6060 | mstore(0x40, m2) |
| 6061 | mstore(0x60, m3) |
| 6062 | mstore(0x80, m4) |
| 6063 | mstore(0xa0, m5) |
| 6064 | mstore(0xc0, m6) |
| 6065 | } |
| 6066 | } |
| 6067 | |
| 6068 | function log(bool p0, address p1, bytes32 p2, uint256 p3) internal pure { |
| 6069 | bytes32 m0; |
| 6070 | bytes32 m1; |
| 6071 | bytes32 m2; |
| 6072 | bytes32 m3; |
| 6073 | bytes32 m4; |
| 6074 | bytes32 m5; |
| 6075 | bytes32 m6; |
| 6076 | /// @solidity memory-safe-assembly |
| 6077 | assembly { |
| 6078 | function writeString(pos, w) { |
| 6079 | let length := 0 |
| 6080 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 6081 | mstore(pos, length) |
| 6082 | let shift := sub(256, shl(3, length)) |
| 6083 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 6084 | } |
| 6085 | m0 := mload(0x00) |
| 6086 | m1 := mload(0x20) |
| 6087 | m2 := mload(0x40) |
| 6088 | m3 := mload(0x60) |
| 6089 | m4 := mload(0x80) |
| 6090 | m5 := mload(0xa0) |
| 6091 | m6 := mload(0xc0) |
| 6092 | // Selector of `log(bool,address,string,uint256)`. |
| 6093 | mstore(0x00, 0xc21f64c7) |
| 6094 | mstore(0x20, p0) |
| 6095 | mstore(0x40, p1) |
| 6096 | mstore(0x60, 0x80) |
| 6097 | mstore(0x80, p3) |
| 6098 | writeString(0xa0, p2) |
| 6099 | } |
| 6100 | _sendLogPayload(0x1c, 0xc4); |
| 6101 | /// @solidity memory-safe-assembly |
| 6102 | assembly { |
| 6103 | mstore(0x00, m0) |
| 6104 | mstore(0x20, m1) |
| 6105 | mstore(0x40, m2) |
| 6106 | mstore(0x60, m3) |
| 6107 | mstore(0x80, m4) |
| 6108 | mstore(0xa0, m5) |
| 6109 | mstore(0xc0, m6) |
| 6110 | } |
| 6111 | } |
| 6112 | |
| 6113 | function log(bool p0, address p1, bytes32 p2, bytes32 p3) internal pure { |
| 6114 | bytes32 m0; |
| 6115 | bytes32 m1; |
| 6116 | bytes32 m2; |
| 6117 | bytes32 m3; |
| 6118 | bytes32 m4; |
| 6119 | bytes32 m5; |
| 6120 | bytes32 m6; |
| 6121 | bytes32 m7; |
| 6122 | bytes32 m8; |
| 6123 | /// @solidity memory-safe-assembly |
| 6124 | assembly { |
| 6125 | function writeString(pos, w) { |
| 6126 | let length := 0 |
| 6127 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 6128 | mstore(pos, length) |
| 6129 | let shift := sub(256, shl(3, length)) |
| 6130 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 6131 | } |
| 6132 | m0 := mload(0x00) |
| 6133 | m1 := mload(0x20) |
| 6134 | m2 := mload(0x40) |
| 6135 | m3 := mload(0x60) |
| 6136 | m4 := mload(0x80) |
| 6137 | m5 := mload(0xa0) |
| 6138 | m6 := mload(0xc0) |
| 6139 | m7 := mload(0xe0) |
| 6140 | m8 := mload(0x100) |
| 6141 | // Selector of `log(bool,address,string,string)`. |
| 6142 | mstore(0x00, 0xa73c1db6) |
| 6143 | mstore(0x20, p0) |
| 6144 | mstore(0x40, p1) |
| 6145 | mstore(0x60, 0x80) |
| 6146 | mstore(0x80, 0xc0) |
| 6147 | writeString(0xa0, p2) |
| 6148 | writeString(0xe0, p3) |
| 6149 | } |
| 6150 | _sendLogPayload(0x1c, 0x104); |
| 6151 | /// @solidity memory-safe-assembly |
| 6152 | assembly { |
| 6153 | mstore(0x00, m0) |
| 6154 | mstore(0x20, m1) |
| 6155 | mstore(0x40, m2) |
| 6156 | mstore(0x60, m3) |
| 6157 | mstore(0x80, m4) |
| 6158 | mstore(0xa0, m5) |
| 6159 | mstore(0xc0, m6) |
| 6160 | mstore(0xe0, m7) |
| 6161 | mstore(0x100, m8) |
| 6162 | } |
| 6163 | } |
| 6164 | |
| 6165 | function log(bool p0, bool p1, address p2, address p3) internal pure { |
| 6166 | bytes32 m0; |
| 6167 | bytes32 m1; |
| 6168 | bytes32 m2; |
| 6169 | bytes32 m3; |
| 6170 | bytes32 m4; |
| 6171 | /// @solidity memory-safe-assembly |
| 6172 | assembly { |
| 6173 | m0 := mload(0x00) |
| 6174 | m1 := mload(0x20) |
| 6175 | m2 := mload(0x40) |
| 6176 | m3 := mload(0x60) |
| 6177 | m4 := mload(0x80) |
| 6178 | // Selector of `log(bool,bool,address,address)`. |
| 6179 | mstore(0x00, 0xf4880ea4) |
| 6180 | mstore(0x20, p0) |
| 6181 | mstore(0x40, p1) |
| 6182 | mstore(0x60, p2) |
| 6183 | mstore(0x80, p3) |
| 6184 | } |
| 6185 | _sendLogPayload(0x1c, 0x84); |
| 6186 | /// @solidity memory-safe-assembly |
| 6187 | assembly { |
| 6188 | mstore(0x00, m0) |
| 6189 | mstore(0x20, m1) |
| 6190 | mstore(0x40, m2) |
| 6191 | mstore(0x60, m3) |
| 6192 | mstore(0x80, m4) |
| 6193 | } |
| 6194 | } |
| 6195 | |
| 6196 | function log(bool p0, bool p1, address p2, bool p3) internal pure { |
| 6197 | bytes32 m0; |
| 6198 | bytes32 m1; |
| 6199 | bytes32 m2; |
| 6200 | bytes32 m3; |
| 6201 | bytes32 m4; |
| 6202 | /// @solidity memory-safe-assembly |
| 6203 | assembly { |
| 6204 | m0 := mload(0x00) |
| 6205 | m1 := mload(0x20) |
| 6206 | m2 := mload(0x40) |
| 6207 | m3 := mload(0x60) |
| 6208 | m4 := mload(0x80) |
| 6209 | // Selector of `log(bool,bool,address,bool)`. |
| 6210 | mstore(0x00, 0xc0a302d8) |
| 6211 | mstore(0x20, p0) |
| 6212 | mstore(0x40, p1) |
| 6213 | mstore(0x60, p2) |
| 6214 | mstore(0x80, p3) |
| 6215 | } |
| 6216 | _sendLogPayload(0x1c, 0x84); |
| 6217 | /// @solidity memory-safe-assembly |
| 6218 | assembly { |
| 6219 | mstore(0x00, m0) |
| 6220 | mstore(0x20, m1) |
| 6221 | mstore(0x40, m2) |
| 6222 | mstore(0x60, m3) |
| 6223 | mstore(0x80, m4) |
| 6224 | } |
| 6225 | } |
| 6226 | |
| 6227 | function log(bool p0, bool p1, address p2, uint256 p3) internal pure { |
| 6228 | bytes32 m0; |
| 6229 | bytes32 m1; |
| 6230 | bytes32 m2; |
| 6231 | bytes32 m3; |
| 6232 | bytes32 m4; |
| 6233 | /// @solidity memory-safe-assembly |
| 6234 | assembly { |
| 6235 | m0 := mload(0x00) |
| 6236 | m1 := mload(0x20) |
| 6237 | m2 := mload(0x40) |
| 6238 | m3 := mload(0x60) |
| 6239 | m4 := mload(0x80) |
| 6240 | // Selector of `log(bool,bool,address,uint256)`. |
| 6241 | mstore(0x00, 0x4c123d57) |
| 6242 | mstore(0x20, p0) |
| 6243 | mstore(0x40, p1) |
| 6244 | mstore(0x60, p2) |
| 6245 | mstore(0x80, p3) |
| 6246 | } |
| 6247 | _sendLogPayload(0x1c, 0x84); |
| 6248 | /// @solidity memory-safe-assembly |
| 6249 | assembly { |
| 6250 | mstore(0x00, m0) |
| 6251 | mstore(0x20, m1) |
| 6252 | mstore(0x40, m2) |
| 6253 | mstore(0x60, m3) |
| 6254 | mstore(0x80, m4) |
| 6255 | } |
| 6256 | } |
| 6257 | |
| 6258 | function log(bool p0, bool p1, address p2, bytes32 p3) internal pure { |
| 6259 | bytes32 m0; |
| 6260 | bytes32 m1; |
| 6261 | bytes32 m2; |
| 6262 | bytes32 m3; |
| 6263 | bytes32 m4; |
| 6264 | bytes32 m5; |
| 6265 | bytes32 m6; |
| 6266 | /// @solidity memory-safe-assembly |
| 6267 | assembly { |
| 6268 | function writeString(pos, w) { |
| 6269 | let length := 0 |
| 6270 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 6271 | mstore(pos, length) |
| 6272 | let shift := sub(256, shl(3, length)) |
| 6273 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 6274 | } |
| 6275 | m0 := mload(0x00) |
| 6276 | m1 := mload(0x20) |
| 6277 | m2 := mload(0x40) |
| 6278 | m3 := mload(0x60) |
| 6279 | m4 := mload(0x80) |
| 6280 | m5 := mload(0xa0) |
| 6281 | m6 := mload(0xc0) |
| 6282 | // Selector of `log(bool,bool,address,string)`. |
| 6283 | mstore(0x00, 0xa0a47963) |
| 6284 | mstore(0x20, p0) |
| 6285 | mstore(0x40, p1) |
| 6286 | mstore(0x60, p2) |
| 6287 | mstore(0x80, 0x80) |
| 6288 | writeString(0xa0, p3) |
| 6289 | } |
| 6290 | _sendLogPayload(0x1c, 0xc4); |
| 6291 | /// @solidity memory-safe-assembly |
| 6292 | assembly { |
| 6293 | mstore(0x00, m0) |
| 6294 | mstore(0x20, m1) |
| 6295 | mstore(0x40, m2) |
| 6296 | mstore(0x60, m3) |
| 6297 | mstore(0x80, m4) |
| 6298 | mstore(0xa0, m5) |
| 6299 | mstore(0xc0, m6) |
| 6300 | } |
| 6301 | } |
| 6302 | |
| 6303 | function log(bool p0, bool p1, bool p2, address p3) internal pure { |
| 6304 | bytes32 m0; |
| 6305 | bytes32 m1; |
| 6306 | bytes32 m2; |
| 6307 | bytes32 m3; |
| 6308 | bytes32 m4; |
| 6309 | /// @solidity memory-safe-assembly |
| 6310 | assembly { |
| 6311 | m0 := mload(0x00) |
| 6312 | m1 := mload(0x20) |
| 6313 | m2 := mload(0x40) |
| 6314 | m3 := mload(0x60) |
| 6315 | m4 := mload(0x80) |
| 6316 | // Selector of `log(bool,bool,bool,address)`. |
| 6317 | mstore(0x00, 0x8c329b1a) |
| 6318 | mstore(0x20, p0) |
| 6319 | mstore(0x40, p1) |
| 6320 | mstore(0x60, p2) |
| 6321 | mstore(0x80, p3) |
| 6322 | } |
| 6323 | _sendLogPayload(0x1c, 0x84); |
| 6324 | /// @solidity memory-safe-assembly |
| 6325 | assembly { |
| 6326 | mstore(0x00, m0) |
| 6327 | mstore(0x20, m1) |
| 6328 | mstore(0x40, m2) |
| 6329 | mstore(0x60, m3) |
| 6330 | mstore(0x80, m4) |
| 6331 | } |
| 6332 | } |
| 6333 | |
| 6334 | function log(bool p0, bool p1, bool p2, bool p3) internal pure { |
| 6335 | bytes32 m0; |
| 6336 | bytes32 m1; |
| 6337 | bytes32 m2; |
| 6338 | bytes32 m3; |
| 6339 | bytes32 m4; |
| 6340 | /// @solidity memory-safe-assembly |
| 6341 | assembly { |
| 6342 | m0 := mload(0x00) |
| 6343 | m1 := mload(0x20) |
| 6344 | m2 := mload(0x40) |
| 6345 | m3 := mload(0x60) |
| 6346 | m4 := mload(0x80) |
| 6347 | // Selector of `log(bool,bool,bool,bool)`. |
| 6348 | mstore(0x00, 0x3b2a5ce0) |
| 6349 | mstore(0x20, p0) |
| 6350 | mstore(0x40, p1) |
| 6351 | mstore(0x60, p2) |
| 6352 | mstore(0x80, p3) |
| 6353 | } |
| 6354 | _sendLogPayload(0x1c, 0x84); |
| 6355 | /// @solidity memory-safe-assembly |
| 6356 | assembly { |
| 6357 | mstore(0x00, m0) |
| 6358 | mstore(0x20, m1) |
| 6359 | mstore(0x40, m2) |
| 6360 | mstore(0x60, m3) |
| 6361 | mstore(0x80, m4) |
| 6362 | } |
| 6363 | } |
| 6364 | |
| 6365 | function log(bool p0, bool p1, bool p2, uint256 p3) internal pure { |
| 6366 | bytes32 m0; |
| 6367 | bytes32 m1; |
| 6368 | bytes32 m2; |
| 6369 | bytes32 m3; |
| 6370 | bytes32 m4; |
| 6371 | /// @solidity memory-safe-assembly |
| 6372 | assembly { |
| 6373 | m0 := mload(0x00) |
| 6374 | m1 := mload(0x20) |
| 6375 | m2 := mload(0x40) |
| 6376 | m3 := mload(0x60) |
| 6377 | m4 := mload(0x80) |
| 6378 | // Selector of `log(bool,bool,bool,uint256)`. |
| 6379 | mstore(0x00, 0x6d7045c1) |
| 6380 | mstore(0x20, p0) |
| 6381 | mstore(0x40, p1) |
| 6382 | mstore(0x60, p2) |
| 6383 | mstore(0x80, p3) |
| 6384 | } |
| 6385 | _sendLogPayload(0x1c, 0x84); |
| 6386 | /// @solidity memory-safe-assembly |
| 6387 | assembly { |
| 6388 | mstore(0x00, m0) |
| 6389 | mstore(0x20, m1) |
| 6390 | mstore(0x40, m2) |
| 6391 | mstore(0x60, m3) |
| 6392 | mstore(0x80, m4) |
| 6393 | } |
| 6394 | } |
| 6395 | |
| 6396 | function log(bool p0, bool p1, bool p2, bytes32 p3) internal pure { |
| 6397 | bytes32 m0; |
| 6398 | bytes32 m1; |
| 6399 | bytes32 m2; |
| 6400 | bytes32 m3; |
| 6401 | bytes32 m4; |
| 6402 | bytes32 m5; |
| 6403 | bytes32 m6; |
| 6404 | /// @solidity memory-safe-assembly |
| 6405 | assembly { |
| 6406 | function writeString(pos, w) { |
| 6407 | let length := 0 |
| 6408 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 6409 | mstore(pos, length) |
| 6410 | let shift := sub(256, shl(3, length)) |
| 6411 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 6412 | } |
| 6413 | m0 := mload(0x00) |
| 6414 | m1 := mload(0x20) |
| 6415 | m2 := mload(0x40) |
| 6416 | m3 := mload(0x60) |
| 6417 | m4 := mload(0x80) |
| 6418 | m5 := mload(0xa0) |
| 6419 | m6 := mload(0xc0) |
| 6420 | // Selector of `log(bool,bool,bool,string)`. |
| 6421 | mstore(0x00, 0x2ae408d4) |
| 6422 | mstore(0x20, p0) |
| 6423 | mstore(0x40, p1) |
| 6424 | mstore(0x60, p2) |
| 6425 | mstore(0x80, 0x80) |
| 6426 | writeString(0xa0, p3) |
| 6427 | } |
| 6428 | _sendLogPayload(0x1c, 0xc4); |
| 6429 | /// @solidity memory-safe-assembly |
| 6430 | assembly { |
| 6431 | mstore(0x00, m0) |
| 6432 | mstore(0x20, m1) |
| 6433 | mstore(0x40, m2) |
| 6434 | mstore(0x60, m3) |
| 6435 | mstore(0x80, m4) |
| 6436 | mstore(0xa0, m5) |
| 6437 | mstore(0xc0, m6) |
| 6438 | } |
| 6439 | } |
| 6440 | |
| 6441 | function log(bool p0, bool p1, uint256 p2, address p3) internal pure { |
| 6442 | bytes32 m0; |
| 6443 | bytes32 m1; |
| 6444 | bytes32 m2; |
| 6445 | bytes32 m3; |
| 6446 | bytes32 m4; |
| 6447 | /// @solidity memory-safe-assembly |
| 6448 | assembly { |
| 6449 | m0 := mload(0x00) |
| 6450 | m1 := mload(0x20) |
| 6451 | m2 := mload(0x40) |
| 6452 | m3 := mload(0x60) |
| 6453 | m4 := mload(0x80) |
| 6454 | // Selector of `log(bool,bool,uint256,address)`. |
| 6455 | mstore(0x00, 0x54a7a9a0) |
| 6456 | mstore(0x20, p0) |
| 6457 | mstore(0x40, p1) |
| 6458 | mstore(0x60, p2) |
| 6459 | mstore(0x80, p3) |
| 6460 | } |
| 6461 | _sendLogPayload(0x1c, 0x84); |
| 6462 | /// @solidity memory-safe-assembly |
| 6463 | assembly { |
| 6464 | mstore(0x00, m0) |
| 6465 | mstore(0x20, m1) |
| 6466 | mstore(0x40, m2) |
| 6467 | mstore(0x60, m3) |
| 6468 | mstore(0x80, m4) |
| 6469 | } |
| 6470 | } |
| 6471 | |
| 6472 | function log(bool p0, bool p1, uint256 p2, bool p3) internal pure { |
| 6473 | bytes32 m0; |
| 6474 | bytes32 m1; |
| 6475 | bytes32 m2; |
| 6476 | bytes32 m3; |
| 6477 | bytes32 m4; |
| 6478 | /// @solidity memory-safe-assembly |
| 6479 | assembly { |
| 6480 | m0 := mload(0x00) |
| 6481 | m1 := mload(0x20) |
| 6482 | m2 := mload(0x40) |
| 6483 | m3 := mload(0x60) |
| 6484 | m4 := mload(0x80) |
| 6485 | // Selector of `log(bool,bool,uint256,bool)`. |
| 6486 | mstore(0x00, 0x619e4d0e) |
| 6487 | mstore(0x20, p0) |
| 6488 | mstore(0x40, p1) |
| 6489 | mstore(0x60, p2) |
| 6490 | mstore(0x80, p3) |
| 6491 | } |
| 6492 | _sendLogPayload(0x1c, 0x84); |
| 6493 | /// @solidity memory-safe-assembly |
| 6494 | assembly { |
| 6495 | mstore(0x00, m0) |
| 6496 | mstore(0x20, m1) |
| 6497 | mstore(0x40, m2) |
| 6498 | mstore(0x60, m3) |
| 6499 | mstore(0x80, m4) |
| 6500 | } |
| 6501 | } |
| 6502 | |
| 6503 | function log(bool p0, bool p1, uint256 p2, uint256 p3) internal pure { |
| 6504 | bytes32 m0; |
| 6505 | bytes32 m1; |
| 6506 | bytes32 m2; |
| 6507 | bytes32 m3; |
| 6508 | bytes32 m4; |
| 6509 | /// @solidity memory-safe-assembly |
| 6510 | assembly { |
| 6511 | m0 := mload(0x00) |
| 6512 | m1 := mload(0x20) |
| 6513 | m2 := mload(0x40) |
| 6514 | m3 := mload(0x60) |
| 6515 | m4 := mload(0x80) |
| 6516 | // Selector of `log(bool,bool,uint256,uint256)`. |
| 6517 | mstore(0x00, 0x0bb00eab) |
| 6518 | mstore(0x20, p0) |
| 6519 | mstore(0x40, p1) |
| 6520 | mstore(0x60, p2) |
| 6521 | mstore(0x80, p3) |
| 6522 | } |
| 6523 | _sendLogPayload(0x1c, 0x84); |
| 6524 | /// @solidity memory-safe-assembly |
| 6525 | assembly { |
| 6526 | mstore(0x00, m0) |
| 6527 | mstore(0x20, m1) |
| 6528 | mstore(0x40, m2) |
| 6529 | mstore(0x60, m3) |
| 6530 | mstore(0x80, m4) |
| 6531 | } |
| 6532 | } |
| 6533 | |
| 6534 | function log(bool p0, bool p1, uint256 p2, bytes32 p3) internal pure { |
| 6535 | bytes32 m0; |
| 6536 | bytes32 m1; |
| 6537 | bytes32 m2; |
| 6538 | bytes32 m3; |
| 6539 | bytes32 m4; |
| 6540 | bytes32 m5; |
| 6541 | bytes32 m6; |
| 6542 | /// @solidity memory-safe-assembly |
| 6543 | assembly { |
| 6544 | function writeString(pos, w) { |
| 6545 | let length := 0 |
| 6546 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 6547 | mstore(pos, length) |
| 6548 | let shift := sub(256, shl(3, length)) |
| 6549 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 6550 | } |
| 6551 | m0 := mload(0x00) |
| 6552 | m1 := mload(0x20) |
| 6553 | m2 := mload(0x40) |
| 6554 | m3 := mload(0x60) |
| 6555 | m4 := mload(0x80) |
| 6556 | m5 := mload(0xa0) |
| 6557 | m6 := mload(0xc0) |
| 6558 | // Selector of `log(bool,bool,uint256,string)`. |
| 6559 | mstore(0x00, 0x7dd4d0e0) |
| 6560 | mstore(0x20, p0) |
| 6561 | mstore(0x40, p1) |
| 6562 | mstore(0x60, p2) |
| 6563 | mstore(0x80, 0x80) |
| 6564 | writeString(0xa0, p3) |
| 6565 | } |
| 6566 | _sendLogPayload(0x1c, 0xc4); |
| 6567 | /// @solidity memory-safe-assembly |
| 6568 | assembly { |
| 6569 | mstore(0x00, m0) |
| 6570 | mstore(0x20, m1) |
| 6571 | mstore(0x40, m2) |
| 6572 | mstore(0x60, m3) |
| 6573 | mstore(0x80, m4) |
| 6574 | mstore(0xa0, m5) |
| 6575 | mstore(0xc0, m6) |
| 6576 | } |
| 6577 | } |
| 6578 | |
| 6579 | function log(bool p0, bool p1, bytes32 p2, address p3) internal pure { |
| 6580 | bytes32 m0; |
| 6581 | bytes32 m1; |
| 6582 | bytes32 m2; |
| 6583 | bytes32 m3; |
| 6584 | bytes32 m4; |
| 6585 | bytes32 m5; |
| 6586 | bytes32 m6; |
| 6587 | /// @solidity memory-safe-assembly |
| 6588 | assembly { |
| 6589 | function writeString(pos, w) { |
| 6590 | let length := 0 |
| 6591 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 6592 | mstore(pos, length) |
| 6593 | let shift := sub(256, shl(3, length)) |
| 6594 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 6595 | } |
| 6596 | m0 := mload(0x00) |
| 6597 | m1 := mload(0x20) |
| 6598 | m2 := mload(0x40) |
| 6599 | m3 := mload(0x60) |
| 6600 | m4 := mload(0x80) |
| 6601 | m5 := mload(0xa0) |
| 6602 | m6 := mload(0xc0) |
| 6603 | // Selector of `log(bool,bool,string,address)`. |
| 6604 | mstore(0x00, 0xf9ad2b89) |
| 6605 | mstore(0x20, p0) |
| 6606 | mstore(0x40, p1) |
| 6607 | mstore(0x60, 0x80) |
| 6608 | mstore(0x80, p3) |
| 6609 | writeString(0xa0, p2) |
| 6610 | } |
| 6611 | _sendLogPayload(0x1c, 0xc4); |
| 6612 | /// @solidity memory-safe-assembly |
| 6613 | assembly { |
| 6614 | mstore(0x00, m0) |
| 6615 | mstore(0x20, m1) |
| 6616 | mstore(0x40, m2) |
| 6617 | mstore(0x60, m3) |
| 6618 | mstore(0x80, m4) |
| 6619 | mstore(0xa0, m5) |
| 6620 | mstore(0xc0, m6) |
| 6621 | } |
| 6622 | } |
| 6623 | |
| 6624 | function log(bool p0, bool p1, bytes32 p2, bool p3) internal pure { |
| 6625 | bytes32 m0; |
| 6626 | bytes32 m1; |
| 6627 | bytes32 m2; |
| 6628 | bytes32 m3; |
| 6629 | bytes32 m4; |
| 6630 | bytes32 m5; |
| 6631 | bytes32 m6; |
| 6632 | /// @solidity memory-safe-assembly |
| 6633 | assembly { |
| 6634 | function writeString(pos, w) { |
| 6635 | let length := 0 |
| 6636 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 6637 | mstore(pos, length) |
| 6638 | let shift := sub(256, shl(3, length)) |
| 6639 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 6640 | } |
| 6641 | m0 := mload(0x00) |
| 6642 | m1 := mload(0x20) |
| 6643 | m2 := mload(0x40) |
| 6644 | m3 := mload(0x60) |
| 6645 | m4 := mload(0x80) |
| 6646 | m5 := mload(0xa0) |
| 6647 | m6 := mload(0xc0) |
| 6648 | // Selector of `log(bool,bool,string,bool)`. |
| 6649 | mstore(0x00, 0xb857163a) |
| 6650 | mstore(0x20, p0) |
| 6651 | mstore(0x40, p1) |
| 6652 | mstore(0x60, 0x80) |
| 6653 | mstore(0x80, p3) |
| 6654 | writeString(0xa0, p2) |
| 6655 | } |
| 6656 | _sendLogPayload(0x1c, 0xc4); |
| 6657 | /// @solidity memory-safe-assembly |
| 6658 | assembly { |
| 6659 | mstore(0x00, m0) |
| 6660 | mstore(0x20, m1) |
| 6661 | mstore(0x40, m2) |
| 6662 | mstore(0x60, m3) |
| 6663 | mstore(0x80, m4) |
| 6664 | mstore(0xa0, m5) |
| 6665 | mstore(0xc0, m6) |
| 6666 | } |
| 6667 | } |
| 6668 | |
| 6669 | function log(bool p0, bool p1, bytes32 p2, uint256 p3) internal pure { |
| 6670 | bytes32 m0; |
| 6671 | bytes32 m1; |
| 6672 | bytes32 m2; |
| 6673 | bytes32 m3; |
| 6674 | bytes32 m4; |
| 6675 | bytes32 m5; |
| 6676 | bytes32 m6; |
| 6677 | /// @solidity memory-safe-assembly |
| 6678 | assembly { |
| 6679 | function writeString(pos, w) { |
| 6680 | let length := 0 |
| 6681 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 6682 | mstore(pos, length) |
| 6683 | let shift := sub(256, shl(3, length)) |
| 6684 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 6685 | } |
| 6686 | m0 := mload(0x00) |
| 6687 | m1 := mload(0x20) |
| 6688 | m2 := mload(0x40) |
| 6689 | m3 := mload(0x60) |
| 6690 | m4 := mload(0x80) |
| 6691 | m5 := mload(0xa0) |
| 6692 | m6 := mload(0xc0) |
| 6693 | // Selector of `log(bool,bool,string,uint256)`. |
| 6694 | mstore(0x00, 0xe3a9ca2f) |
| 6695 | mstore(0x20, p0) |
| 6696 | mstore(0x40, p1) |
| 6697 | mstore(0x60, 0x80) |
| 6698 | mstore(0x80, p3) |
| 6699 | writeString(0xa0, p2) |
| 6700 | } |
| 6701 | _sendLogPayload(0x1c, 0xc4); |
| 6702 | /// @solidity memory-safe-assembly |
| 6703 | assembly { |
| 6704 | mstore(0x00, m0) |
| 6705 | mstore(0x20, m1) |
| 6706 | mstore(0x40, m2) |
| 6707 | mstore(0x60, m3) |
| 6708 | mstore(0x80, m4) |
| 6709 | mstore(0xa0, m5) |
| 6710 | mstore(0xc0, m6) |
| 6711 | } |
| 6712 | } |
| 6713 | |
| 6714 | function log(bool p0, bool p1, bytes32 p2, bytes32 p3) internal pure { |
| 6715 | bytes32 m0; |
| 6716 | bytes32 m1; |
| 6717 | bytes32 m2; |
| 6718 | bytes32 m3; |
| 6719 | bytes32 m4; |
| 6720 | bytes32 m5; |
| 6721 | bytes32 m6; |
| 6722 | bytes32 m7; |
| 6723 | bytes32 m8; |
| 6724 | /// @solidity memory-safe-assembly |
| 6725 | assembly { |
| 6726 | function writeString(pos, w) { |
| 6727 | let length := 0 |
| 6728 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 6729 | mstore(pos, length) |
| 6730 | let shift := sub(256, shl(3, length)) |
| 6731 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 6732 | } |
| 6733 | m0 := mload(0x00) |
| 6734 | m1 := mload(0x20) |
| 6735 | m2 := mload(0x40) |
| 6736 | m3 := mload(0x60) |
| 6737 | m4 := mload(0x80) |
| 6738 | m5 := mload(0xa0) |
| 6739 | m6 := mload(0xc0) |
| 6740 | m7 := mload(0xe0) |
| 6741 | m8 := mload(0x100) |
| 6742 | // Selector of `log(bool,bool,string,string)`. |
| 6743 | mstore(0x00, 0x6d1e8751) |
| 6744 | mstore(0x20, p0) |
| 6745 | mstore(0x40, p1) |
| 6746 | mstore(0x60, 0x80) |
| 6747 | mstore(0x80, 0xc0) |
| 6748 | writeString(0xa0, p2) |
| 6749 | writeString(0xe0, p3) |
| 6750 | } |
| 6751 | _sendLogPayload(0x1c, 0x104); |
| 6752 | /// @solidity memory-safe-assembly |
| 6753 | assembly { |
| 6754 | mstore(0x00, m0) |
| 6755 | mstore(0x20, m1) |
| 6756 | mstore(0x40, m2) |
| 6757 | mstore(0x60, m3) |
| 6758 | mstore(0x80, m4) |
| 6759 | mstore(0xa0, m5) |
| 6760 | mstore(0xc0, m6) |
| 6761 | mstore(0xe0, m7) |
| 6762 | mstore(0x100, m8) |
| 6763 | } |
| 6764 | } |
| 6765 | |
| 6766 | function log(bool p0, uint256 p1, address p2, address p3) internal pure { |
| 6767 | bytes32 m0; |
| 6768 | bytes32 m1; |
| 6769 | bytes32 m2; |
| 6770 | bytes32 m3; |
| 6771 | bytes32 m4; |
| 6772 | /// @solidity memory-safe-assembly |
| 6773 | assembly { |
| 6774 | m0 := mload(0x00) |
| 6775 | m1 := mload(0x20) |
| 6776 | m2 := mload(0x40) |
| 6777 | m3 := mload(0x60) |
| 6778 | m4 := mload(0x80) |
| 6779 | // Selector of `log(bool,uint256,address,address)`. |
| 6780 | mstore(0x00, 0x26f560a8) |
| 6781 | mstore(0x20, p0) |
| 6782 | mstore(0x40, p1) |
| 6783 | mstore(0x60, p2) |
| 6784 | mstore(0x80, p3) |
| 6785 | } |
| 6786 | _sendLogPayload(0x1c, 0x84); |
| 6787 | /// @solidity memory-safe-assembly |
| 6788 | assembly { |
| 6789 | mstore(0x00, m0) |
| 6790 | mstore(0x20, m1) |
| 6791 | mstore(0x40, m2) |
| 6792 | mstore(0x60, m3) |
| 6793 | mstore(0x80, m4) |
| 6794 | } |
| 6795 | } |
| 6796 | |
| 6797 | function log(bool p0, uint256 p1, address p2, bool p3) internal pure { |
| 6798 | bytes32 m0; |
| 6799 | bytes32 m1; |
| 6800 | bytes32 m2; |
| 6801 | bytes32 m3; |
| 6802 | bytes32 m4; |
| 6803 | /// @solidity memory-safe-assembly |
| 6804 | assembly { |
| 6805 | m0 := mload(0x00) |
| 6806 | m1 := mload(0x20) |
| 6807 | m2 := mload(0x40) |
| 6808 | m3 := mload(0x60) |
| 6809 | m4 := mload(0x80) |
| 6810 | // Selector of `log(bool,uint256,address,bool)`. |
| 6811 | mstore(0x00, 0xb4c314ff) |
| 6812 | mstore(0x20, p0) |
| 6813 | mstore(0x40, p1) |
| 6814 | mstore(0x60, p2) |
| 6815 | mstore(0x80, p3) |
| 6816 | } |
| 6817 | _sendLogPayload(0x1c, 0x84); |
| 6818 | /// @solidity memory-safe-assembly |
| 6819 | assembly { |
| 6820 | mstore(0x00, m0) |
| 6821 | mstore(0x20, m1) |
| 6822 | mstore(0x40, m2) |
| 6823 | mstore(0x60, m3) |
| 6824 | mstore(0x80, m4) |
| 6825 | } |
| 6826 | } |
| 6827 | |
| 6828 | function log(bool p0, uint256 p1, address p2, uint256 p3) internal pure { |
| 6829 | bytes32 m0; |
| 6830 | bytes32 m1; |
| 6831 | bytes32 m2; |
| 6832 | bytes32 m3; |
| 6833 | bytes32 m4; |
| 6834 | /// @solidity memory-safe-assembly |
| 6835 | assembly { |
| 6836 | m0 := mload(0x00) |
| 6837 | m1 := mload(0x20) |
| 6838 | m2 := mload(0x40) |
| 6839 | m3 := mload(0x60) |
| 6840 | m4 := mload(0x80) |
| 6841 | // Selector of `log(bool,uint256,address,uint256)`. |
| 6842 | mstore(0x00, 0x1537dc87) |
| 6843 | mstore(0x20, p0) |
| 6844 | mstore(0x40, p1) |
| 6845 | mstore(0x60, p2) |
| 6846 | mstore(0x80, p3) |
| 6847 | } |
| 6848 | _sendLogPayload(0x1c, 0x84); |
| 6849 | /// @solidity memory-safe-assembly |
| 6850 | assembly { |
| 6851 | mstore(0x00, m0) |
| 6852 | mstore(0x20, m1) |
| 6853 | mstore(0x40, m2) |
| 6854 | mstore(0x60, m3) |
| 6855 | mstore(0x80, m4) |
| 6856 | } |
| 6857 | } |
| 6858 | |
| 6859 | function log(bool p0, uint256 p1, address p2, bytes32 p3) internal pure { |
| 6860 | bytes32 m0; |
| 6861 | bytes32 m1; |
| 6862 | bytes32 m2; |
| 6863 | bytes32 m3; |
| 6864 | bytes32 m4; |
| 6865 | bytes32 m5; |
| 6866 | bytes32 m6; |
| 6867 | /// @solidity memory-safe-assembly |
| 6868 | assembly { |
| 6869 | function writeString(pos, w) { |
| 6870 | let length := 0 |
| 6871 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 6872 | mstore(pos, length) |
| 6873 | let shift := sub(256, shl(3, length)) |
| 6874 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 6875 | } |
| 6876 | m0 := mload(0x00) |
| 6877 | m1 := mload(0x20) |
| 6878 | m2 := mload(0x40) |
| 6879 | m3 := mload(0x60) |
| 6880 | m4 := mload(0x80) |
| 6881 | m5 := mload(0xa0) |
| 6882 | m6 := mload(0xc0) |
| 6883 | // Selector of `log(bool,uint256,address,string)`. |
| 6884 | mstore(0x00, 0x1bb3b09a) |
| 6885 | mstore(0x20, p0) |
| 6886 | mstore(0x40, p1) |
| 6887 | mstore(0x60, p2) |
| 6888 | mstore(0x80, 0x80) |
| 6889 | writeString(0xa0, p3) |
| 6890 | } |
| 6891 | _sendLogPayload(0x1c, 0xc4); |
| 6892 | /// @solidity memory-safe-assembly |
| 6893 | assembly { |
| 6894 | mstore(0x00, m0) |
| 6895 | mstore(0x20, m1) |
| 6896 | mstore(0x40, m2) |
| 6897 | mstore(0x60, m3) |
| 6898 | mstore(0x80, m4) |
| 6899 | mstore(0xa0, m5) |
| 6900 | mstore(0xc0, m6) |
| 6901 | } |
| 6902 | } |
| 6903 | |
| 6904 | function log(bool p0, uint256 p1, bool p2, address p3) internal pure { |
| 6905 | bytes32 m0; |
| 6906 | bytes32 m1; |
| 6907 | bytes32 m2; |
| 6908 | bytes32 m3; |
| 6909 | bytes32 m4; |
| 6910 | /// @solidity memory-safe-assembly |
| 6911 | assembly { |
| 6912 | m0 := mload(0x00) |
| 6913 | m1 := mload(0x20) |
| 6914 | m2 := mload(0x40) |
| 6915 | m3 := mload(0x60) |
| 6916 | m4 := mload(0x80) |
| 6917 | // Selector of `log(bool,uint256,bool,address)`. |
| 6918 | mstore(0x00, 0x9acd3616) |
| 6919 | mstore(0x20, p0) |
| 6920 | mstore(0x40, p1) |
| 6921 | mstore(0x60, p2) |
| 6922 | mstore(0x80, p3) |
| 6923 | } |
| 6924 | _sendLogPayload(0x1c, 0x84); |
| 6925 | /// @solidity memory-safe-assembly |
| 6926 | assembly { |
| 6927 | mstore(0x00, m0) |
| 6928 | mstore(0x20, m1) |
| 6929 | mstore(0x40, m2) |
| 6930 | mstore(0x60, m3) |
| 6931 | mstore(0x80, m4) |
| 6932 | } |
| 6933 | } |
| 6934 | |
| 6935 | function log(bool p0, uint256 p1, bool p2, bool p3) internal pure { |
| 6936 | bytes32 m0; |
| 6937 | bytes32 m1; |
| 6938 | bytes32 m2; |
| 6939 | bytes32 m3; |
| 6940 | bytes32 m4; |
| 6941 | /// @solidity memory-safe-assembly |
| 6942 | assembly { |
| 6943 | m0 := mload(0x00) |
| 6944 | m1 := mload(0x20) |
| 6945 | m2 := mload(0x40) |
| 6946 | m3 := mload(0x60) |
| 6947 | m4 := mload(0x80) |
| 6948 | // Selector of `log(bool,uint256,bool,bool)`. |
| 6949 | mstore(0x00, 0xceb5f4d7) |
| 6950 | mstore(0x20, p0) |
| 6951 | mstore(0x40, p1) |
| 6952 | mstore(0x60, p2) |
| 6953 | mstore(0x80, p3) |
| 6954 | } |
| 6955 | _sendLogPayload(0x1c, 0x84); |
| 6956 | /// @solidity memory-safe-assembly |
| 6957 | assembly { |
| 6958 | mstore(0x00, m0) |
| 6959 | mstore(0x20, m1) |
| 6960 | mstore(0x40, m2) |
| 6961 | mstore(0x60, m3) |
| 6962 | mstore(0x80, m4) |
| 6963 | } |
| 6964 | } |
| 6965 | |
| 6966 | function log(bool p0, uint256 p1, bool p2, uint256 p3) internal pure { |
| 6967 | bytes32 m0; |
| 6968 | bytes32 m1; |
| 6969 | bytes32 m2; |
| 6970 | bytes32 m3; |
| 6971 | bytes32 m4; |
| 6972 | /// @solidity memory-safe-assembly |
| 6973 | assembly { |
| 6974 | m0 := mload(0x00) |
| 6975 | m1 := mload(0x20) |
| 6976 | m2 := mload(0x40) |
| 6977 | m3 := mload(0x60) |
| 6978 | m4 := mload(0x80) |
| 6979 | // Selector of `log(bool,uint256,bool,uint256)`. |
| 6980 | mstore(0x00, 0x7f9bbca2) |
| 6981 | mstore(0x20, p0) |
| 6982 | mstore(0x40, p1) |
| 6983 | mstore(0x60, p2) |
| 6984 | mstore(0x80, p3) |
| 6985 | } |
| 6986 | _sendLogPayload(0x1c, 0x84); |
| 6987 | /// @solidity memory-safe-assembly |
| 6988 | assembly { |
| 6989 | mstore(0x00, m0) |
| 6990 | mstore(0x20, m1) |
| 6991 | mstore(0x40, m2) |
| 6992 | mstore(0x60, m3) |
| 6993 | mstore(0x80, m4) |
| 6994 | } |
| 6995 | } |
| 6996 | |
| 6997 | function log(bool p0, uint256 p1, bool p2, bytes32 p3) internal pure { |
| 6998 | bytes32 m0; |
| 6999 | bytes32 m1; |
| 7000 | bytes32 m2; |
| 7001 | bytes32 m3; |
| 7002 | bytes32 m4; |
| 7003 | bytes32 m5; |
| 7004 | bytes32 m6; |
| 7005 | /// @solidity memory-safe-assembly |
| 7006 | assembly { |
| 7007 | function writeString(pos, w) { |
| 7008 | let length := 0 |
| 7009 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 7010 | mstore(pos, length) |
| 7011 | let shift := sub(256, shl(3, length)) |
| 7012 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 7013 | } |
| 7014 | m0 := mload(0x00) |
| 7015 | m1 := mload(0x20) |
| 7016 | m2 := mload(0x40) |
| 7017 | m3 := mload(0x60) |
| 7018 | m4 := mload(0x80) |
| 7019 | m5 := mload(0xa0) |
| 7020 | m6 := mload(0xc0) |
| 7021 | // Selector of `log(bool,uint256,bool,string)`. |
| 7022 | mstore(0x00, 0x9143dbb1) |
| 7023 | mstore(0x20, p0) |
| 7024 | mstore(0x40, p1) |
| 7025 | mstore(0x60, p2) |
| 7026 | mstore(0x80, 0x80) |
| 7027 | writeString(0xa0, p3) |
| 7028 | } |
| 7029 | _sendLogPayload(0x1c, 0xc4); |
| 7030 | /// @solidity memory-safe-assembly |
| 7031 | assembly { |
| 7032 | mstore(0x00, m0) |
| 7033 | mstore(0x20, m1) |
| 7034 | mstore(0x40, m2) |
| 7035 | mstore(0x60, m3) |
| 7036 | mstore(0x80, m4) |
| 7037 | mstore(0xa0, m5) |
| 7038 | mstore(0xc0, m6) |
| 7039 | } |
| 7040 | } |
| 7041 | |
| 7042 | function log(bool p0, uint256 p1, uint256 p2, address p3) internal pure { |
| 7043 | bytes32 m0; |
| 7044 | bytes32 m1; |
| 7045 | bytes32 m2; |
| 7046 | bytes32 m3; |
| 7047 | bytes32 m4; |
| 7048 | /// @solidity memory-safe-assembly |
| 7049 | assembly { |
| 7050 | m0 := mload(0x00) |
| 7051 | m1 := mload(0x20) |
| 7052 | m2 := mload(0x40) |
| 7053 | m3 := mload(0x60) |
| 7054 | m4 := mload(0x80) |
| 7055 | // Selector of `log(bool,uint256,uint256,address)`. |
| 7056 | mstore(0x00, 0x00dd87b9) |
| 7057 | mstore(0x20, p0) |
| 7058 | mstore(0x40, p1) |
| 7059 | mstore(0x60, p2) |
| 7060 | mstore(0x80, p3) |
| 7061 | } |
| 7062 | _sendLogPayload(0x1c, 0x84); |
| 7063 | /// @solidity memory-safe-assembly |
| 7064 | assembly { |
| 7065 | mstore(0x00, m0) |
| 7066 | mstore(0x20, m1) |
| 7067 | mstore(0x40, m2) |
| 7068 | mstore(0x60, m3) |
| 7069 | mstore(0x80, m4) |
| 7070 | } |
| 7071 | } |
| 7072 | |
| 7073 | function log(bool p0, uint256 p1, uint256 p2, bool p3) internal pure { |
| 7074 | bytes32 m0; |
| 7075 | bytes32 m1; |
| 7076 | bytes32 m2; |
| 7077 | bytes32 m3; |
| 7078 | bytes32 m4; |
| 7079 | /// @solidity memory-safe-assembly |
| 7080 | assembly { |
| 7081 | m0 := mload(0x00) |
| 7082 | m1 := mload(0x20) |
| 7083 | m2 := mload(0x40) |
| 7084 | m3 := mload(0x60) |
| 7085 | m4 := mload(0x80) |
| 7086 | // Selector of `log(bool,uint256,uint256,bool)`. |
| 7087 | mstore(0x00, 0xbe984353) |
| 7088 | mstore(0x20, p0) |
| 7089 | mstore(0x40, p1) |
| 7090 | mstore(0x60, p2) |
| 7091 | mstore(0x80, p3) |
| 7092 | } |
| 7093 | _sendLogPayload(0x1c, 0x84); |
| 7094 | /// @solidity memory-safe-assembly |
| 7095 | assembly { |
| 7096 | mstore(0x00, m0) |
| 7097 | mstore(0x20, m1) |
| 7098 | mstore(0x40, m2) |
| 7099 | mstore(0x60, m3) |
| 7100 | mstore(0x80, m4) |
| 7101 | } |
| 7102 | } |
| 7103 | |
| 7104 | function log(bool p0, uint256 p1, uint256 p2, uint256 p3) internal pure { |
| 7105 | bytes32 m0; |
| 7106 | bytes32 m1; |
| 7107 | bytes32 m2; |
| 7108 | bytes32 m3; |
| 7109 | bytes32 m4; |
| 7110 | /// @solidity memory-safe-assembly |
| 7111 | assembly { |
| 7112 | m0 := mload(0x00) |
| 7113 | m1 := mload(0x20) |
| 7114 | m2 := mload(0x40) |
| 7115 | m3 := mload(0x60) |
| 7116 | m4 := mload(0x80) |
| 7117 | // Selector of `log(bool,uint256,uint256,uint256)`. |
| 7118 | mstore(0x00, 0x374bb4b2) |
| 7119 | mstore(0x20, p0) |
| 7120 | mstore(0x40, p1) |
| 7121 | mstore(0x60, p2) |
| 7122 | mstore(0x80, p3) |
| 7123 | } |
| 7124 | _sendLogPayload(0x1c, 0x84); |
| 7125 | /// @solidity memory-safe-assembly |
| 7126 | assembly { |
| 7127 | mstore(0x00, m0) |
| 7128 | mstore(0x20, m1) |
| 7129 | mstore(0x40, m2) |
| 7130 | mstore(0x60, m3) |
| 7131 | mstore(0x80, m4) |
| 7132 | } |
| 7133 | } |
| 7134 | |
| 7135 | function log(bool p0, uint256 p1, uint256 p2, bytes32 p3) internal pure { |
| 7136 | bytes32 m0; |
| 7137 | bytes32 m1; |
| 7138 | bytes32 m2; |
| 7139 | bytes32 m3; |
| 7140 | bytes32 m4; |
| 7141 | bytes32 m5; |
| 7142 | bytes32 m6; |
| 7143 | /// @solidity memory-safe-assembly |
| 7144 | assembly { |
| 7145 | function writeString(pos, w) { |
| 7146 | let length := 0 |
| 7147 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 7148 | mstore(pos, length) |
| 7149 | let shift := sub(256, shl(3, length)) |
| 7150 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 7151 | } |
| 7152 | m0 := mload(0x00) |
| 7153 | m1 := mload(0x20) |
| 7154 | m2 := mload(0x40) |
| 7155 | m3 := mload(0x60) |
| 7156 | m4 := mload(0x80) |
| 7157 | m5 := mload(0xa0) |
| 7158 | m6 := mload(0xc0) |
| 7159 | // Selector of `log(bool,uint256,uint256,string)`. |
| 7160 | mstore(0x00, 0x8e69fb5d) |
| 7161 | mstore(0x20, p0) |
| 7162 | mstore(0x40, p1) |
| 7163 | mstore(0x60, p2) |
| 7164 | mstore(0x80, 0x80) |
| 7165 | writeString(0xa0, p3) |
| 7166 | } |
| 7167 | _sendLogPayload(0x1c, 0xc4); |
| 7168 | /// @solidity memory-safe-assembly |
| 7169 | assembly { |
| 7170 | mstore(0x00, m0) |
| 7171 | mstore(0x20, m1) |
| 7172 | mstore(0x40, m2) |
| 7173 | mstore(0x60, m3) |
| 7174 | mstore(0x80, m4) |
| 7175 | mstore(0xa0, m5) |
| 7176 | mstore(0xc0, m6) |
| 7177 | } |
| 7178 | } |
| 7179 | |
| 7180 | function log(bool p0, uint256 p1, bytes32 p2, address p3) internal pure { |
| 7181 | bytes32 m0; |
| 7182 | bytes32 m1; |
| 7183 | bytes32 m2; |
| 7184 | bytes32 m3; |
| 7185 | bytes32 m4; |
| 7186 | bytes32 m5; |
| 7187 | bytes32 m6; |
| 7188 | /// @solidity memory-safe-assembly |
| 7189 | assembly { |
| 7190 | function writeString(pos, w) { |
| 7191 | let length := 0 |
| 7192 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 7193 | mstore(pos, length) |
| 7194 | let shift := sub(256, shl(3, length)) |
| 7195 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 7196 | } |
| 7197 | m0 := mload(0x00) |
| 7198 | m1 := mload(0x20) |
| 7199 | m2 := mload(0x40) |
| 7200 | m3 := mload(0x60) |
| 7201 | m4 := mload(0x80) |
| 7202 | m5 := mload(0xa0) |
| 7203 | m6 := mload(0xc0) |
| 7204 | // Selector of `log(bool,uint256,string,address)`. |
| 7205 | mstore(0x00, 0xfedd1fff) |
| 7206 | mstore(0x20, p0) |
| 7207 | mstore(0x40, p1) |
| 7208 | mstore(0x60, 0x80) |
| 7209 | mstore(0x80, p3) |
| 7210 | writeString(0xa0, p2) |
| 7211 | } |
| 7212 | _sendLogPayload(0x1c, 0xc4); |
| 7213 | /// @solidity memory-safe-assembly |
| 7214 | assembly { |
| 7215 | mstore(0x00, m0) |
| 7216 | mstore(0x20, m1) |
| 7217 | mstore(0x40, m2) |
| 7218 | mstore(0x60, m3) |
| 7219 | mstore(0x80, m4) |
| 7220 | mstore(0xa0, m5) |
| 7221 | mstore(0xc0, m6) |
| 7222 | } |
| 7223 | } |
| 7224 | |
| 7225 | function log(bool p0, uint256 p1, bytes32 p2, bool p3) internal pure { |
| 7226 | bytes32 m0; |
| 7227 | bytes32 m1; |
| 7228 | bytes32 m2; |
| 7229 | bytes32 m3; |
| 7230 | bytes32 m4; |
| 7231 | bytes32 m5; |
| 7232 | bytes32 m6; |
| 7233 | /// @solidity memory-safe-assembly |
| 7234 | assembly { |
| 7235 | function writeString(pos, w) { |
| 7236 | let length := 0 |
| 7237 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 7238 | mstore(pos, length) |
| 7239 | let shift := sub(256, shl(3, length)) |
| 7240 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 7241 | } |
| 7242 | m0 := mload(0x00) |
| 7243 | m1 := mload(0x20) |
| 7244 | m2 := mload(0x40) |
| 7245 | m3 := mload(0x60) |
| 7246 | m4 := mload(0x80) |
| 7247 | m5 := mload(0xa0) |
| 7248 | m6 := mload(0xc0) |
| 7249 | // Selector of `log(bool,uint256,string,bool)`. |
| 7250 | mstore(0x00, 0xe5e70b2b) |
| 7251 | mstore(0x20, p0) |
| 7252 | mstore(0x40, p1) |
| 7253 | mstore(0x60, 0x80) |
| 7254 | mstore(0x80, p3) |
| 7255 | writeString(0xa0, p2) |
| 7256 | } |
| 7257 | _sendLogPayload(0x1c, 0xc4); |
| 7258 | /// @solidity memory-safe-assembly |
| 7259 | assembly { |
| 7260 | mstore(0x00, m0) |
| 7261 | mstore(0x20, m1) |
| 7262 | mstore(0x40, m2) |
| 7263 | mstore(0x60, m3) |
| 7264 | mstore(0x80, m4) |
| 7265 | mstore(0xa0, m5) |
| 7266 | mstore(0xc0, m6) |
| 7267 | } |
| 7268 | } |
| 7269 | |
| 7270 | function log(bool p0, uint256 p1, bytes32 p2, uint256 p3) internal pure { |
| 7271 | bytes32 m0; |
| 7272 | bytes32 m1; |
| 7273 | bytes32 m2; |
| 7274 | bytes32 m3; |
| 7275 | bytes32 m4; |
| 7276 | bytes32 m5; |
| 7277 | bytes32 m6; |
| 7278 | /// @solidity memory-safe-assembly |
| 7279 | assembly { |
| 7280 | function writeString(pos, w) { |
| 7281 | let length := 0 |
| 7282 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 7283 | mstore(pos, length) |
| 7284 | let shift := sub(256, shl(3, length)) |
| 7285 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 7286 | } |
| 7287 | m0 := mload(0x00) |
| 7288 | m1 := mload(0x20) |
| 7289 | m2 := mload(0x40) |
| 7290 | m3 := mload(0x60) |
| 7291 | m4 := mload(0x80) |
| 7292 | m5 := mload(0xa0) |
| 7293 | m6 := mload(0xc0) |
| 7294 | // Selector of `log(bool,uint256,string,uint256)`. |
| 7295 | mstore(0x00, 0x6a1199e2) |
| 7296 | mstore(0x20, p0) |
| 7297 | mstore(0x40, p1) |
| 7298 | mstore(0x60, 0x80) |
| 7299 | mstore(0x80, p3) |
| 7300 | writeString(0xa0, p2) |
| 7301 | } |
| 7302 | _sendLogPayload(0x1c, 0xc4); |
| 7303 | /// @solidity memory-safe-assembly |
| 7304 | assembly { |
| 7305 | mstore(0x00, m0) |
| 7306 | mstore(0x20, m1) |
| 7307 | mstore(0x40, m2) |
| 7308 | mstore(0x60, m3) |
| 7309 | mstore(0x80, m4) |
| 7310 | mstore(0xa0, m5) |
| 7311 | mstore(0xc0, m6) |
| 7312 | } |
| 7313 | } |
| 7314 | |
| 7315 | function log(bool p0, uint256 p1, bytes32 p2, bytes32 p3) internal pure { |
| 7316 | bytes32 m0; |
| 7317 | bytes32 m1; |
| 7318 | bytes32 m2; |
| 7319 | bytes32 m3; |
| 7320 | bytes32 m4; |
| 7321 | bytes32 m5; |
| 7322 | bytes32 m6; |
| 7323 | bytes32 m7; |
| 7324 | bytes32 m8; |
| 7325 | /// @solidity memory-safe-assembly |
| 7326 | assembly { |
| 7327 | function writeString(pos, w) { |
| 7328 | let length := 0 |
| 7329 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 7330 | mstore(pos, length) |
| 7331 | let shift := sub(256, shl(3, length)) |
| 7332 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 7333 | } |
| 7334 | m0 := mload(0x00) |
| 7335 | m1 := mload(0x20) |
| 7336 | m2 := mload(0x40) |
| 7337 | m3 := mload(0x60) |
| 7338 | m4 := mload(0x80) |
| 7339 | m5 := mload(0xa0) |
| 7340 | m6 := mload(0xc0) |
| 7341 | m7 := mload(0xe0) |
| 7342 | m8 := mload(0x100) |
| 7343 | // Selector of `log(bool,uint256,string,string)`. |
| 7344 | mstore(0x00, 0xf5bc2249) |
| 7345 | mstore(0x20, p0) |
| 7346 | mstore(0x40, p1) |
| 7347 | mstore(0x60, 0x80) |
| 7348 | mstore(0x80, 0xc0) |
| 7349 | writeString(0xa0, p2) |
| 7350 | writeString(0xe0, p3) |
| 7351 | } |
| 7352 | _sendLogPayload(0x1c, 0x104); |
| 7353 | /// @solidity memory-safe-assembly |
| 7354 | assembly { |
| 7355 | mstore(0x00, m0) |
| 7356 | mstore(0x20, m1) |
| 7357 | mstore(0x40, m2) |
| 7358 | mstore(0x60, m3) |
| 7359 | mstore(0x80, m4) |
| 7360 | mstore(0xa0, m5) |
| 7361 | mstore(0xc0, m6) |
| 7362 | mstore(0xe0, m7) |
| 7363 | mstore(0x100, m8) |
| 7364 | } |
| 7365 | } |
| 7366 | |
| 7367 | function log(bool p0, bytes32 p1, address p2, address p3) internal pure { |
| 7368 | bytes32 m0; |
| 7369 | bytes32 m1; |
| 7370 | bytes32 m2; |
| 7371 | bytes32 m3; |
| 7372 | bytes32 m4; |
| 7373 | bytes32 m5; |
| 7374 | bytes32 m6; |
| 7375 | /// @solidity memory-safe-assembly |
| 7376 | assembly { |
| 7377 | function writeString(pos, w) { |
| 7378 | let length := 0 |
| 7379 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 7380 | mstore(pos, length) |
| 7381 | let shift := sub(256, shl(3, length)) |
| 7382 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 7383 | } |
| 7384 | m0 := mload(0x00) |
| 7385 | m1 := mload(0x20) |
| 7386 | m2 := mload(0x40) |
| 7387 | m3 := mload(0x60) |
| 7388 | m4 := mload(0x80) |
| 7389 | m5 := mload(0xa0) |
| 7390 | m6 := mload(0xc0) |
| 7391 | // Selector of `log(bool,string,address,address)`. |
| 7392 | mstore(0x00, 0x2b2b18dc) |
| 7393 | mstore(0x20, p0) |
| 7394 | mstore(0x40, 0x80) |
| 7395 | mstore(0x60, p2) |
| 7396 | mstore(0x80, p3) |
| 7397 | writeString(0xa0, p1) |
| 7398 | } |
| 7399 | _sendLogPayload(0x1c, 0xc4); |
| 7400 | /// @solidity memory-safe-assembly |
| 7401 | assembly { |
| 7402 | mstore(0x00, m0) |
| 7403 | mstore(0x20, m1) |
| 7404 | mstore(0x40, m2) |
| 7405 | mstore(0x60, m3) |
| 7406 | mstore(0x80, m4) |
| 7407 | mstore(0xa0, m5) |
| 7408 | mstore(0xc0, m6) |
| 7409 | } |
| 7410 | } |
| 7411 | |
| 7412 | function log(bool p0, bytes32 p1, address p2, bool p3) internal pure { |
| 7413 | bytes32 m0; |
| 7414 | bytes32 m1; |
| 7415 | bytes32 m2; |
| 7416 | bytes32 m3; |
| 7417 | bytes32 m4; |
| 7418 | bytes32 m5; |
| 7419 | bytes32 m6; |
| 7420 | /// @solidity memory-safe-assembly |
| 7421 | assembly { |
| 7422 | function writeString(pos, w) { |
| 7423 | let length := 0 |
| 7424 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 7425 | mstore(pos, length) |
| 7426 | let shift := sub(256, shl(3, length)) |
| 7427 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 7428 | } |
| 7429 | m0 := mload(0x00) |
| 7430 | m1 := mload(0x20) |
| 7431 | m2 := mload(0x40) |
| 7432 | m3 := mload(0x60) |
| 7433 | m4 := mload(0x80) |
| 7434 | m5 := mload(0xa0) |
| 7435 | m6 := mload(0xc0) |
| 7436 | // Selector of `log(bool,string,address,bool)`. |
| 7437 | mstore(0x00, 0x6dd434ca) |
| 7438 | mstore(0x20, p0) |
| 7439 | mstore(0x40, 0x80) |
| 7440 | mstore(0x60, p2) |
| 7441 | mstore(0x80, p3) |
| 7442 | writeString(0xa0, p1) |
| 7443 | } |
| 7444 | _sendLogPayload(0x1c, 0xc4); |
| 7445 | /// @solidity memory-safe-assembly |
| 7446 | assembly { |
| 7447 | mstore(0x00, m0) |
| 7448 | mstore(0x20, m1) |
| 7449 | mstore(0x40, m2) |
| 7450 | mstore(0x60, m3) |
| 7451 | mstore(0x80, m4) |
| 7452 | mstore(0xa0, m5) |
| 7453 | mstore(0xc0, m6) |
| 7454 | } |
| 7455 | } |
| 7456 | |
| 7457 | function log(bool p0, bytes32 p1, address p2, uint256 p3) internal pure { |
| 7458 | bytes32 m0; |
| 7459 | bytes32 m1; |
| 7460 | bytes32 m2; |
| 7461 | bytes32 m3; |
| 7462 | bytes32 m4; |
| 7463 | bytes32 m5; |
| 7464 | bytes32 m6; |
| 7465 | /// @solidity memory-safe-assembly |
| 7466 | assembly { |
| 7467 | function writeString(pos, w) { |
| 7468 | let length := 0 |
| 7469 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 7470 | mstore(pos, length) |
| 7471 | let shift := sub(256, shl(3, length)) |
| 7472 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 7473 | } |
| 7474 | m0 := mload(0x00) |
| 7475 | m1 := mload(0x20) |
| 7476 | m2 := mload(0x40) |
| 7477 | m3 := mload(0x60) |
| 7478 | m4 := mload(0x80) |
| 7479 | m5 := mload(0xa0) |
| 7480 | m6 := mload(0xc0) |
| 7481 | // Selector of `log(bool,string,address,uint256)`. |
| 7482 | mstore(0x00, 0xa5cada94) |
| 7483 | mstore(0x20, p0) |
| 7484 | mstore(0x40, 0x80) |
| 7485 | mstore(0x60, p2) |
| 7486 | mstore(0x80, p3) |
| 7487 | writeString(0xa0, p1) |
| 7488 | } |
| 7489 | _sendLogPayload(0x1c, 0xc4); |
| 7490 | /// @solidity memory-safe-assembly |
| 7491 | assembly { |
| 7492 | mstore(0x00, m0) |
| 7493 | mstore(0x20, m1) |
| 7494 | mstore(0x40, m2) |
| 7495 | mstore(0x60, m3) |
| 7496 | mstore(0x80, m4) |
| 7497 | mstore(0xa0, m5) |
| 7498 | mstore(0xc0, m6) |
| 7499 | } |
| 7500 | } |
| 7501 | |
| 7502 | function log(bool p0, bytes32 p1, address p2, bytes32 p3) internal pure { |
| 7503 | bytes32 m0; |
| 7504 | bytes32 m1; |
| 7505 | bytes32 m2; |
| 7506 | bytes32 m3; |
| 7507 | bytes32 m4; |
| 7508 | bytes32 m5; |
| 7509 | bytes32 m6; |
| 7510 | bytes32 m7; |
| 7511 | bytes32 m8; |
| 7512 | /// @solidity memory-safe-assembly |
| 7513 | assembly { |
| 7514 | function writeString(pos, w) { |
| 7515 | let length := 0 |
| 7516 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 7517 | mstore(pos, length) |
| 7518 | let shift := sub(256, shl(3, length)) |
| 7519 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 7520 | } |
| 7521 | m0 := mload(0x00) |
| 7522 | m1 := mload(0x20) |
| 7523 | m2 := mload(0x40) |
| 7524 | m3 := mload(0x60) |
| 7525 | m4 := mload(0x80) |
| 7526 | m5 := mload(0xa0) |
| 7527 | m6 := mload(0xc0) |
| 7528 | m7 := mload(0xe0) |
| 7529 | m8 := mload(0x100) |
| 7530 | // Selector of `log(bool,string,address,string)`. |
| 7531 | mstore(0x00, 0x12d6c788) |
| 7532 | mstore(0x20, p0) |
| 7533 | mstore(0x40, 0x80) |
| 7534 | mstore(0x60, p2) |
| 7535 | mstore(0x80, 0xc0) |
| 7536 | writeString(0xa0, p1) |
| 7537 | writeString(0xe0, p3) |
| 7538 | } |
| 7539 | _sendLogPayload(0x1c, 0x104); |
| 7540 | /// @solidity memory-safe-assembly |
| 7541 | assembly { |
| 7542 | mstore(0x00, m0) |
| 7543 | mstore(0x20, m1) |
| 7544 | mstore(0x40, m2) |
| 7545 | mstore(0x60, m3) |
| 7546 | mstore(0x80, m4) |
| 7547 | mstore(0xa0, m5) |
| 7548 | mstore(0xc0, m6) |
| 7549 | mstore(0xe0, m7) |
| 7550 | mstore(0x100, m8) |
| 7551 | } |
| 7552 | } |
| 7553 | |
| 7554 | function log(bool p0, bytes32 p1, bool p2, address p3) internal pure { |
| 7555 | bytes32 m0; |
| 7556 | bytes32 m1; |
| 7557 | bytes32 m2; |
| 7558 | bytes32 m3; |
| 7559 | bytes32 m4; |
| 7560 | bytes32 m5; |
| 7561 | bytes32 m6; |
| 7562 | /// @solidity memory-safe-assembly |
| 7563 | assembly { |
| 7564 | function writeString(pos, w) { |
| 7565 | let length := 0 |
| 7566 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 7567 | mstore(pos, length) |
| 7568 | let shift := sub(256, shl(3, length)) |
| 7569 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 7570 | } |
| 7571 | m0 := mload(0x00) |
| 7572 | m1 := mload(0x20) |
| 7573 | m2 := mload(0x40) |
| 7574 | m3 := mload(0x60) |
| 7575 | m4 := mload(0x80) |
| 7576 | m5 := mload(0xa0) |
| 7577 | m6 := mload(0xc0) |
| 7578 | // Selector of `log(bool,string,bool,address)`. |
| 7579 | mstore(0x00, 0x538e06ab) |
| 7580 | mstore(0x20, p0) |
| 7581 | mstore(0x40, 0x80) |
| 7582 | mstore(0x60, p2) |
| 7583 | mstore(0x80, p3) |
| 7584 | writeString(0xa0, p1) |
| 7585 | } |
| 7586 | _sendLogPayload(0x1c, 0xc4); |
| 7587 | /// @solidity memory-safe-assembly |
| 7588 | assembly { |
| 7589 | mstore(0x00, m0) |
| 7590 | mstore(0x20, m1) |
| 7591 | mstore(0x40, m2) |
| 7592 | mstore(0x60, m3) |
| 7593 | mstore(0x80, m4) |
| 7594 | mstore(0xa0, m5) |
| 7595 | mstore(0xc0, m6) |
| 7596 | } |
| 7597 | } |
| 7598 | |
| 7599 | function log(bool p0, bytes32 p1, bool p2, bool p3) internal pure { |
| 7600 | bytes32 m0; |
| 7601 | bytes32 m1; |
| 7602 | bytes32 m2; |
| 7603 | bytes32 m3; |
| 7604 | bytes32 m4; |
| 7605 | bytes32 m5; |
| 7606 | bytes32 m6; |
| 7607 | /// @solidity memory-safe-assembly |
| 7608 | assembly { |
| 7609 | function writeString(pos, w) { |
| 7610 | let length := 0 |
| 7611 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 7612 | mstore(pos, length) |
| 7613 | let shift := sub(256, shl(3, length)) |
| 7614 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 7615 | } |
| 7616 | m0 := mload(0x00) |
| 7617 | m1 := mload(0x20) |
| 7618 | m2 := mload(0x40) |
| 7619 | m3 := mload(0x60) |
| 7620 | m4 := mload(0x80) |
| 7621 | m5 := mload(0xa0) |
| 7622 | m6 := mload(0xc0) |
| 7623 | // Selector of `log(bool,string,bool,bool)`. |
| 7624 | mstore(0x00, 0xdc5e935b) |
| 7625 | mstore(0x20, p0) |
| 7626 | mstore(0x40, 0x80) |
| 7627 | mstore(0x60, p2) |
| 7628 | mstore(0x80, p3) |
| 7629 | writeString(0xa0, p1) |
| 7630 | } |
| 7631 | _sendLogPayload(0x1c, 0xc4); |
| 7632 | /// @solidity memory-safe-assembly |
| 7633 | assembly { |
| 7634 | mstore(0x00, m0) |
| 7635 | mstore(0x20, m1) |
| 7636 | mstore(0x40, m2) |
| 7637 | mstore(0x60, m3) |
| 7638 | mstore(0x80, m4) |
| 7639 | mstore(0xa0, m5) |
| 7640 | mstore(0xc0, m6) |
| 7641 | } |
| 7642 | } |
| 7643 | |
| 7644 | function log(bool p0, bytes32 p1, bool p2, uint256 p3) internal pure { |
| 7645 | bytes32 m0; |
| 7646 | bytes32 m1; |
| 7647 | bytes32 m2; |
| 7648 | bytes32 m3; |
| 7649 | bytes32 m4; |
| 7650 | bytes32 m5; |
| 7651 | bytes32 m6; |
| 7652 | /// @solidity memory-safe-assembly |
| 7653 | assembly { |
| 7654 | function writeString(pos, w) { |
| 7655 | let length := 0 |
| 7656 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 7657 | mstore(pos, length) |
| 7658 | let shift := sub(256, shl(3, length)) |
| 7659 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 7660 | } |
| 7661 | m0 := mload(0x00) |
| 7662 | m1 := mload(0x20) |
| 7663 | m2 := mload(0x40) |
| 7664 | m3 := mload(0x60) |
| 7665 | m4 := mload(0x80) |
| 7666 | m5 := mload(0xa0) |
| 7667 | m6 := mload(0xc0) |
| 7668 | // Selector of `log(bool,string,bool,uint256)`. |
| 7669 | mstore(0x00, 0x1606a393) |
| 7670 | mstore(0x20, p0) |
| 7671 | mstore(0x40, 0x80) |
| 7672 | mstore(0x60, p2) |
| 7673 | mstore(0x80, p3) |
| 7674 | writeString(0xa0, p1) |
| 7675 | } |
| 7676 | _sendLogPayload(0x1c, 0xc4); |
| 7677 | /// @solidity memory-safe-assembly |
| 7678 | assembly { |
| 7679 | mstore(0x00, m0) |
| 7680 | mstore(0x20, m1) |
| 7681 | mstore(0x40, m2) |
| 7682 | mstore(0x60, m3) |
| 7683 | mstore(0x80, m4) |
| 7684 | mstore(0xa0, m5) |
| 7685 | mstore(0xc0, m6) |
| 7686 | } |
| 7687 | } |
| 7688 | |
| 7689 | function log(bool p0, bytes32 p1, bool p2, bytes32 p3) internal pure { |
| 7690 | bytes32 m0; |
| 7691 | bytes32 m1; |
| 7692 | bytes32 m2; |
| 7693 | bytes32 m3; |
| 7694 | bytes32 m4; |
| 7695 | bytes32 m5; |
| 7696 | bytes32 m6; |
| 7697 | bytes32 m7; |
| 7698 | bytes32 m8; |
| 7699 | /// @solidity memory-safe-assembly |
| 7700 | assembly { |
| 7701 | function writeString(pos, w) { |
| 7702 | let length := 0 |
| 7703 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 7704 | mstore(pos, length) |
| 7705 | let shift := sub(256, shl(3, length)) |
| 7706 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 7707 | } |
| 7708 | m0 := mload(0x00) |
| 7709 | m1 := mload(0x20) |
| 7710 | m2 := mload(0x40) |
| 7711 | m3 := mload(0x60) |
| 7712 | m4 := mload(0x80) |
| 7713 | m5 := mload(0xa0) |
| 7714 | m6 := mload(0xc0) |
| 7715 | m7 := mload(0xe0) |
| 7716 | m8 := mload(0x100) |
| 7717 | // Selector of `log(bool,string,bool,string)`. |
| 7718 | mstore(0x00, 0x483d0416) |
| 7719 | mstore(0x20, p0) |
| 7720 | mstore(0x40, 0x80) |
| 7721 | mstore(0x60, p2) |
| 7722 | mstore(0x80, 0xc0) |
| 7723 | writeString(0xa0, p1) |
| 7724 | writeString(0xe0, p3) |
| 7725 | } |
| 7726 | _sendLogPayload(0x1c, 0x104); |
| 7727 | /// @solidity memory-safe-assembly |
| 7728 | assembly { |
| 7729 | mstore(0x00, m0) |
| 7730 | mstore(0x20, m1) |
| 7731 | mstore(0x40, m2) |
| 7732 | mstore(0x60, m3) |
| 7733 | mstore(0x80, m4) |
| 7734 | mstore(0xa0, m5) |
| 7735 | mstore(0xc0, m6) |
| 7736 | mstore(0xe0, m7) |
| 7737 | mstore(0x100, m8) |
| 7738 | } |
| 7739 | } |
| 7740 | |
| 7741 | function log(bool p0, bytes32 p1, uint256 p2, address p3) internal pure { |
| 7742 | bytes32 m0; |
| 7743 | bytes32 m1; |
| 7744 | bytes32 m2; |
| 7745 | bytes32 m3; |
| 7746 | bytes32 m4; |
| 7747 | bytes32 m5; |
| 7748 | bytes32 m6; |
| 7749 | /// @solidity memory-safe-assembly |
| 7750 | assembly { |
| 7751 | function writeString(pos, w) { |
| 7752 | let length := 0 |
| 7753 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 7754 | mstore(pos, length) |
| 7755 | let shift := sub(256, shl(3, length)) |
| 7756 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 7757 | } |
| 7758 | m0 := mload(0x00) |
| 7759 | m1 := mload(0x20) |
| 7760 | m2 := mload(0x40) |
| 7761 | m3 := mload(0x60) |
| 7762 | m4 := mload(0x80) |
| 7763 | m5 := mload(0xa0) |
| 7764 | m6 := mload(0xc0) |
| 7765 | // Selector of `log(bool,string,uint256,address)`. |
| 7766 | mstore(0x00, 0x1596a1ce) |
| 7767 | mstore(0x20, p0) |
| 7768 | mstore(0x40, 0x80) |
| 7769 | mstore(0x60, p2) |
| 7770 | mstore(0x80, p3) |
| 7771 | writeString(0xa0, p1) |
| 7772 | } |
| 7773 | _sendLogPayload(0x1c, 0xc4); |
| 7774 | /// @solidity memory-safe-assembly |
| 7775 | assembly { |
| 7776 | mstore(0x00, m0) |
| 7777 | mstore(0x20, m1) |
| 7778 | mstore(0x40, m2) |
| 7779 | mstore(0x60, m3) |
| 7780 | mstore(0x80, m4) |
| 7781 | mstore(0xa0, m5) |
| 7782 | mstore(0xc0, m6) |
| 7783 | } |
| 7784 | } |
| 7785 | |
| 7786 | function log(bool p0, bytes32 p1, uint256 p2, bool p3) internal pure { |
| 7787 | bytes32 m0; |
| 7788 | bytes32 m1; |
| 7789 | bytes32 m2; |
| 7790 | bytes32 m3; |
| 7791 | bytes32 m4; |
| 7792 | bytes32 m5; |
| 7793 | bytes32 m6; |
| 7794 | /// @solidity memory-safe-assembly |
| 7795 | assembly { |
| 7796 | function writeString(pos, w) { |
| 7797 | let length := 0 |
| 7798 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 7799 | mstore(pos, length) |
| 7800 | let shift := sub(256, shl(3, length)) |
| 7801 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 7802 | } |
| 7803 | m0 := mload(0x00) |
| 7804 | m1 := mload(0x20) |
| 7805 | m2 := mload(0x40) |
| 7806 | m3 := mload(0x60) |
| 7807 | m4 := mload(0x80) |
| 7808 | m5 := mload(0xa0) |
| 7809 | m6 := mload(0xc0) |
| 7810 | // Selector of `log(bool,string,uint256,bool)`. |
| 7811 | mstore(0x00, 0x6b0e5d53) |
| 7812 | mstore(0x20, p0) |
| 7813 | mstore(0x40, 0x80) |
| 7814 | mstore(0x60, p2) |
| 7815 | mstore(0x80, p3) |
| 7816 | writeString(0xa0, p1) |
| 7817 | } |
| 7818 | _sendLogPayload(0x1c, 0xc4); |
| 7819 | /// @solidity memory-safe-assembly |
| 7820 | assembly { |
| 7821 | mstore(0x00, m0) |
| 7822 | mstore(0x20, m1) |
| 7823 | mstore(0x40, m2) |
| 7824 | mstore(0x60, m3) |
| 7825 | mstore(0x80, m4) |
| 7826 | mstore(0xa0, m5) |
| 7827 | mstore(0xc0, m6) |
| 7828 | } |
| 7829 | } |
| 7830 | |
| 7831 | function log(bool p0, bytes32 p1, uint256 p2, uint256 p3) internal pure { |
| 7832 | bytes32 m0; |
| 7833 | bytes32 m1; |
| 7834 | bytes32 m2; |
| 7835 | bytes32 m3; |
| 7836 | bytes32 m4; |
| 7837 | bytes32 m5; |
| 7838 | bytes32 m6; |
| 7839 | /// @solidity memory-safe-assembly |
| 7840 | assembly { |
| 7841 | function writeString(pos, w) { |
| 7842 | let length := 0 |
| 7843 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 7844 | mstore(pos, length) |
| 7845 | let shift := sub(256, shl(3, length)) |
| 7846 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 7847 | } |
| 7848 | m0 := mload(0x00) |
| 7849 | m1 := mload(0x20) |
| 7850 | m2 := mload(0x40) |
| 7851 | m3 := mload(0x60) |
| 7852 | m4 := mload(0x80) |
| 7853 | m5 := mload(0xa0) |
| 7854 | m6 := mload(0xc0) |
| 7855 | // Selector of `log(bool,string,uint256,uint256)`. |
| 7856 | mstore(0x00, 0x28863fcb) |
| 7857 | mstore(0x20, p0) |
| 7858 | mstore(0x40, 0x80) |
| 7859 | mstore(0x60, p2) |
| 7860 | mstore(0x80, p3) |
| 7861 | writeString(0xa0, p1) |
| 7862 | } |
| 7863 | _sendLogPayload(0x1c, 0xc4); |
| 7864 | /// @solidity memory-safe-assembly |
| 7865 | assembly { |
| 7866 | mstore(0x00, m0) |
| 7867 | mstore(0x20, m1) |
| 7868 | mstore(0x40, m2) |
| 7869 | mstore(0x60, m3) |
| 7870 | mstore(0x80, m4) |
| 7871 | mstore(0xa0, m5) |
| 7872 | mstore(0xc0, m6) |
| 7873 | } |
| 7874 | } |
| 7875 | |
| 7876 | function log(bool p0, bytes32 p1, uint256 p2, bytes32 p3) internal pure { |
| 7877 | bytes32 m0; |
| 7878 | bytes32 m1; |
| 7879 | bytes32 m2; |
| 7880 | bytes32 m3; |
| 7881 | bytes32 m4; |
| 7882 | bytes32 m5; |
| 7883 | bytes32 m6; |
| 7884 | bytes32 m7; |
| 7885 | bytes32 m8; |
| 7886 | /// @solidity memory-safe-assembly |
| 7887 | assembly { |
| 7888 | function writeString(pos, w) { |
| 7889 | let length := 0 |
| 7890 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 7891 | mstore(pos, length) |
| 7892 | let shift := sub(256, shl(3, length)) |
| 7893 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 7894 | } |
| 7895 | m0 := mload(0x00) |
| 7896 | m1 := mload(0x20) |
| 7897 | m2 := mload(0x40) |
| 7898 | m3 := mload(0x60) |
| 7899 | m4 := mload(0x80) |
| 7900 | m5 := mload(0xa0) |
| 7901 | m6 := mload(0xc0) |
| 7902 | m7 := mload(0xe0) |
| 7903 | m8 := mload(0x100) |
| 7904 | // Selector of `log(bool,string,uint256,string)`. |
| 7905 | mstore(0x00, 0x1ad96de6) |
| 7906 | mstore(0x20, p0) |
| 7907 | mstore(0x40, 0x80) |
| 7908 | mstore(0x60, p2) |
| 7909 | mstore(0x80, 0xc0) |
| 7910 | writeString(0xa0, p1) |
| 7911 | writeString(0xe0, p3) |
| 7912 | } |
| 7913 | _sendLogPayload(0x1c, 0x104); |
| 7914 | /// @solidity memory-safe-assembly |
| 7915 | assembly { |
| 7916 | mstore(0x00, m0) |
| 7917 | mstore(0x20, m1) |
| 7918 | mstore(0x40, m2) |
| 7919 | mstore(0x60, m3) |
| 7920 | mstore(0x80, m4) |
| 7921 | mstore(0xa0, m5) |
| 7922 | mstore(0xc0, m6) |
| 7923 | mstore(0xe0, m7) |
| 7924 | mstore(0x100, m8) |
| 7925 | } |
| 7926 | } |
| 7927 | |
| 7928 | function log(bool p0, bytes32 p1, bytes32 p2, address p3) internal pure { |
| 7929 | bytes32 m0; |
| 7930 | bytes32 m1; |
| 7931 | bytes32 m2; |
| 7932 | bytes32 m3; |
| 7933 | bytes32 m4; |
| 7934 | bytes32 m5; |
| 7935 | bytes32 m6; |
| 7936 | bytes32 m7; |
| 7937 | bytes32 m8; |
| 7938 | /// @solidity memory-safe-assembly |
| 7939 | assembly { |
| 7940 | function writeString(pos, w) { |
| 7941 | let length := 0 |
| 7942 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 7943 | mstore(pos, length) |
| 7944 | let shift := sub(256, shl(3, length)) |
| 7945 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 7946 | } |
| 7947 | m0 := mload(0x00) |
| 7948 | m1 := mload(0x20) |
| 7949 | m2 := mload(0x40) |
| 7950 | m3 := mload(0x60) |
| 7951 | m4 := mload(0x80) |
| 7952 | m5 := mload(0xa0) |
| 7953 | m6 := mload(0xc0) |
| 7954 | m7 := mload(0xe0) |
| 7955 | m8 := mload(0x100) |
| 7956 | // Selector of `log(bool,string,string,address)`. |
| 7957 | mstore(0x00, 0x97d394d8) |
| 7958 | mstore(0x20, p0) |
| 7959 | mstore(0x40, 0x80) |
| 7960 | mstore(0x60, 0xc0) |
| 7961 | mstore(0x80, p3) |
| 7962 | writeString(0xa0, p1) |
| 7963 | writeString(0xe0, p2) |
| 7964 | } |
| 7965 | _sendLogPayload(0x1c, 0x104); |
| 7966 | /// @solidity memory-safe-assembly |
| 7967 | assembly { |
| 7968 | mstore(0x00, m0) |
| 7969 | mstore(0x20, m1) |
| 7970 | mstore(0x40, m2) |
| 7971 | mstore(0x60, m3) |
| 7972 | mstore(0x80, m4) |
| 7973 | mstore(0xa0, m5) |
| 7974 | mstore(0xc0, m6) |
| 7975 | mstore(0xe0, m7) |
| 7976 | mstore(0x100, m8) |
| 7977 | } |
| 7978 | } |
| 7979 | |
| 7980 | function log(bool p0, bytes32 p1, bytes32 p2, bool p3) internal pure { |
| 7981 | bytes32 m0; |
| 7982 | bytes32 m1; |
| 7983 | bytes32 m2; |
| 7984 | bytes32 m3; |
| 7985 | bytes32 m4; |
| 7986 | bytes32 m5; |
| 7987 | bytes32 m6; |
| 7988 | bytes32 m7; |
| 7989 | bytes32 m8; |
| 7990 | /// @solidity memory-safe-assembly |
| 7991 | assembly { |
| 7992 | function writeString(pos, w) { |
| 7993 | let length := 0 |
| 7994 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 7995 | mstore(pos, length) |
| 7996 | let shift := sub(256, shl(3, length)) |
| 7997 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 7998 | } |
| 7999 | m0 := mload(0x00) |
| 8000 | m1 := mload(0x20) |
| 8001 | m2 := mload(0x40) |
| 8002 | m3 := mload(0x60) |
| 8003 | m4 := mload(0x80) |
| 8004 | m5 := mload(0xa0) |
| 8005 | m6 := mload(0xc0) |
| 8006 | m7 := mload(0xe0) |
| 8007 | m8 := mload(0x100) |
| 8008 | // Selector of `log(bool,string,string,bool)`. |
| 8009 | mstore(0x00, 0x1e4b87e5) |
| 8010 | mstore(0x20, p0) |
| 8011 | mstore(0x40, 0x80) |
| 8012 | mstore(0x60, 0xc0) |
| 8013 | mstore(0x80, p3) |
| 8014 | writeString(0xa0, p1) |
| 8015 | writeString(0xe0, p2) |
| 8016 | } |
| 8017 | _sendLogPayload(0x1c, 0x104); |
| 8018 | /// @solidity memory-safe-assembly |
| 8019 | assembly { |
| 8020 | mstore(0x00, m0) |
| 8021 | mstore(0x20, m1) |
| 8022 | mstore(0x40, m2) |
| 8023 | mstore(0x60, m3) |
| 8024 | mstore(0x80, m4) |
| 8025 | mstore(0xa0, m5) |
| 8026 | mstore(0xc0, m6) |
| 8027 | mstore(0xe0, m7) |
| 8028 | mstore(0x100, m8) |
| 8029 | } |
| 8030 | } |
| 8031 | |
| 8032 | function log(bool p0, bytes32 p1, bytes32 p2, uint256 p3) internal pure { |
| 8033 | bytes32 m0; |
| 8034 | bytes32 m1; |
| 8035 | bytes32 m2; |
| 8036 | bytes32 m3; |
| 8037 | bytes32 m4; |
| 8038 | bytes32 m5; |
| 8039 | bytes32 m6; |
| 8040 | bytes32 m7; |
| 8041 | bytes32 m8; |
| 8042 | /// @solidity memory-safe-assembly |
| 8043 | assembly { |
| 8044 | function writeString(pos, w) { |
| 8045 | let length := 0 |
| 8046 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 8047 | mstore(pos, length) |
| 8048 | let shift := sub(256, shl(3, length)) |
| 8049 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 8050 | } |
| 8051 | m0 := mload(0x00) |
| 8052 | m1 := mload(0x20) |
| 8053 | m2 := mload(0x40) |
| 8054 | m3 := mload(0x60) |
| 8055 | m4 := mload(0x80) |
| 8056 | m5 := mload(0xa0) |
| 8057 | m6 := mload(0xc0) |
| 8058 | m7 := mload(0xe0) |
| 8059 | m8 := mload(0x100) |
| 8060 | // Selector of `log(bool,string,string,uint256)`. |
| 8061 | mstore(0x00, 0x7be0c3eb) |
| 8062 | mstore(0x20, p0) |
| 8063 | mstore(0x40, 0x80) |
| 8064 | mstore(0x60, 0xc0) |
| 8065 | mstore(0x80, p3) |
| 8066 | writeString(0xa0, p1) |
| 8067 | writeString(0xe0, p2) |
| 8068 | } |
| 8069 | _sendLogPayload(0x1c, 0x104); |
| 8070 | /// @solidity memory-safe-assembly |
| 8071 | assembly { |
| 8072 | mstore(0x00, m0) |
| 8073 | mstore(0x20, m1) |
| 8074 | mstore(0x40, m2) |
| 8075 | mstore(0x60, m3) |
| 8076 | mstore(0x80, m4) |
| 8077 | mstore(0xa0, m5) |
| 8078 | mstore(0xc0, m6) |
| 8079 | mstore(0xe0, m7) |
| 8080 | mstore(0x100, m8) |
| 8081 | } |
| 8082 | } |
| 8083 | |
| 8084 | function log(bool p0, bytes32 p1, bytes32 p2, bytes32 p3) internal pure { |
| 8085 | bytes32 m0; |
| 8086 | bytes32 m1; |
| 8087 | bytes32 m2; |
| 8088 | bytes32 m3; |
| 8089 | bytes32 m4; |
| 8090 | bytes32 m5; |
| 8091 | bytes32 m6; |
| 8092 | bytes32 m7; |
| 8093 | bytes32 m8; |
| 8094 | bytes32 m9; |
| 8095 | bytes32 m10; |
| 8096 | /// @solidity memory-safe-assembly |
| 8097 | assembly { |
| 8098 | function writeString(pos, w) { |
| 8099 | let length := 0 |
| 8100 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 8101 | mstore(pos, length) |
| 8102 | let shift := sub(256, shl(3, length)) |
| 8103 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 8104 | } |
| 8105 | m0 := mload(0x00) |
| 8106 | m1 := mload(0x20) |
| 8107 | m2 := mload(0x40) |
| 8108 | m3 := mload(0x60) |
| 8109 | m4 := mload(0x80) |
| 8110 | m5 := mload(0xa0) |
| 8111 | m6 := mload(0xc0) |
| 8112 | m7 := mload(0xe0) |
| 8113 | m8 := mload(0x100) |
| 8114 | m9 := mload(0x120) |
| 8115 | m10 := mload(0x140) |
| 8116 | // Selector of `log(bool,string,string,string)`. |
| 8117 | mstore(0x00, 0x1762e32a) |
| 8118 | mstore(0x20, p0) |
| 8119 | mstore(0x40, 0x80) |
| 8120 | mstore(0x60, 0xc0) |
| 8121 | mstore(0x80, 0x100) |
| 8122 | writeString(0xa0, p1) |
| 8123 | writeString(0xe0, p2) |
| 8124 | writeString(0x120, p3) |
| 8125 | } |
| 8126 | _sendLogPayload(0x1c, 0x144); |
| 8127 | /// @solidity memory-safe-assembly |
| 8128 | assembly { |
| 8129 | mstore(0x00, m0) |
| 8130 | mstore(0x20, m1) |
| 8131 | mstore(0x40, m2) |
| 8132 | mstore(0x60, m3) |
| 8133 | mstore(0x80, m4) |
| 8134 | mstore(0xa0, m5) |
| 8135 | mstore(0xc0, m6) |
| 8136 | mstore(0xe0, m7) |
| 8137 | mstore(0x100, m8) |
| 8138 | mstore(0x120, m9) |
| 8139 | mstore(0x140, m10) |
| 8140 | } |
| 8141 | } |
| 8142 | |
| 8143 | function log(uint256 p0, address p1, address p2, address p3) internal pure { |
| 8144 | bytes32 m0; |
| 8145 | bytes32 m1; |
| 8146 | bytes32 m2; |
| 8147 | bytes32 m3; |
| 8148 | bytes32 m4; |
| 8149 | /// @solidity memory-safe-assembly |
| 8150 | assembly { |
| 8151 | m0 := mload(0x00) |
| 8152 | m1 := mload(0x20) |
| 8153 | m2 := mload(0x40) |
| 8154 | m3 := mload(0x60) |
| 8155 | m4 := mload(0x80) |
| 8156 | // Selector of `log(uint256,address,address,address)`. |
| 8157 | mstore(0x00, 0x2488b414) |
| 8158 | mstore(0x20, p0) |
| 8159 | mstore(0x40, p1) |
| 8160 | mstore(0x60, p2) |
| 8161 | mstore(0x80, p3) |
| 8162 | } |
| 8163 | _sendLogPayload(0x1c, 0x84); |
| 8164 | /// @solidity memory-safe-assembly |
| 8165 | assembly { |
| 8166 | mstore(0x00, m0) |
| 8167 | mstore(0x20, m1) |
| 8168 | mstore(0x40, m2) |
| 8169 | mstore(0x60, m3) |
| 8170 | mstore(0x80, m4) |
| 8171 | } |
| 8172 | } |
| 8173 | |
| 8174 | function log(uint256 p0, address p1, address p2, bool p3) internal pure { |
| 8175 | bytes32 m0; |
| 8176 | bytes32 m1; |
| 8177 | bytes32 m2; |
| 8178 | bytes32 m3; |
| 8179 | bytes32 m4; |
| 8180 | /// @solidity memory-safe-assembly |
| 8181 | assembly { |
| 8182 | m0 := mload(0x00) |
| 8183 | m1 := mload(0x20) |
| 8184 | m2 := mload(0x40) |
| 8185 | m3 := mload(0x60) |
| 8186 | m4 := mload(0x80) |
| 8187 | // Selector of `log(uint256,address,address,bool)`. |
| 8188 | mstore(0x00, 0x091ffaf5) |
| 8189 | mstore(0x20, p0) |
| 8190 | mstore(0x40, p1) |
| 8191 | mstore(0x60, p2) |
| 8192 | mstore(0x80, p3) |
| 8193 | } |
| 8194 | _sendLogPayload(0x1c, 0x84); |
| 8195 | /// @solidity memory-safe-assembly |
| 8196 | assembly { |
| 8197 | mstore(0x00, m0) |
| 8198 | mstore(0x20, m1) |
| 8199 | mstore(0x40, m2) |
| 8200 | mstore(0x60, m3) |
| 8201 | mstore(0x80, m4) |
| 8202 | } |
| 8203 | } |
| 8204 | |
| 8205 | function log(uint256 p0, address p1, address p2, uint256 p3) internal pure { |
| 8206 | bytes32 m0; |
| 8207 | bytes32 m1; |
| 8208 | bytes32 m2; |
| 8209 | bytes32 m3; |
| 8210 | bytes32 m4; |
| 8211 | /// @solidity memory-safe-assembly |
| 8212 | assembly { |
| 8213 | m0 := mload(0x00) |
| 8214 | m1 := mload(0x20) |
| 8215 | m2 := mload(0x40) |
| 8216 | m3 := mload(0x60) |
| 8217 | m4 := mload(0x80) |
| 8218 | // Selector of `log(uint256,address,address,uint256)`. |
| 8219 | mstore(0x00, 0x736efbb6) |
| 8220 | mstore(0x20, p0) |
| 8221 | mstore(0x40, p1) |
| 8222 | mstore(0x60, p2) |
| 8223 | mstore(0x80, p3) |
| 8224 | } |
| 8225 | _sendLogPayload(0x1c, 0x84); |
| 8226 | /// @solidity memory-safe-assembly |
| 8227 | assembly { |
| 8228 | mstore(0x00, m0) |
| 8229 | mstore(0x20, m1) |
| 8230 | mstore(0x40, m2) |
| 8231 | mstore(0x60, m3) |
| 8232 | mstore(0x80, m4) |
| 8233 | } |
| 8234 | } |
| 8235 | |
| 8236 | function log(uint256 p0, address p1, address p2, bytes32 p3) internal pure { |
| 8237 | bytes32 m0; |
| 8238 | bytes32 m1; |
| 8239 | bytes32 m2; |
| 8240 | bytes32 m3; |
| 8241 | bytes32 m4; |
| 8242 | bytes32 m5; |
| 8243 | bytes32 m6; |
| 8244 | /// @solidity memory-safe-assembly |
| 8245 | assembly { |
| 8246 | function writeString(pos, w) { |
| 8247 | let length := 0 |
| 8248 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 8249 | mstore(pos, length) |
| 8250 | let shift := sub(256, shl(3, length)) |
| 8251 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 8252 | } |
| 8253 | m0 := mload(0x00) |
| 8254 | m1 := mload(0x20) |
| 8255 | m2 := mload(0x40) |
| 8256 | m3 := mload(0x60) |
| 8257 | m4 := mload(0x80) |
| 8258 | m5 := mload(0xa0) |
| 8259 | m6 := mload(0xc0) |
| 8260 | // Selector of `log(uint256,address,address,string)`. |
| 8261 | mstore(0x00, 0x031c6f73) |
| 8262 | mstore(0x20, p0) |
| 8263 | mstore(0x40, p1) |
| 8264 | mstore(0x60, p2) |
| 8265 | mstore(0x80, 0x80) |
| 8266 | writeString(0xa0, p3) |
| 8267 | } |
| 8268 | _sendLogPayload(0x1c, 0xc4); |
| 8269 | /// @solidity memory-safe-assembly |
| 8270 | assembly { |
| 8271 | mstore(0x00, m0) |
| 8272 | mstore(0x20, m1) |
| 8273 | mstore(0x40, m2) |
| 8274 | mstore(0x60, m3) |
| 8275 | mstore(0x80, m4) |
| 8276 | mstore(0xa0, m5) |
| 8277 | mstore(0xc0, m6) |
| 8278 | } |
| 8279 | } |
| 8280 | |
| 8281 | function log(uint256 p0, address p1, bool p2, address p3) internal pure { |
| 8282 | bytes32 m0; |
| 8283 | bytes32 m1; |
| 8284 | bytes32 m2; |
| 8285 | bytes32 m3; |
| 8286 | bytes32 m4; |
| 8287 | /// @solidity memory-safe-assembly |
| 8288 | assembly { |
| 8289 | m0 := mload(0x00) |
| 8290 | m1 := mload(0x20) |
| 8291 | m2 := mload(0x40) |
| 8292 | m3 := mload(0x60) |
| 8293 | m4 := mload(0x80) |
| 8294 | // Selector of `log(uint256,address,bool,address)`. |
| 8295 | mstore(0x00, 0xef72c513) |
| 8296 | mstore(0x20, p0) |
| 8297 | mstore(0x40, p1) |
| 8298 | mstore(0x60, p2) |
| 8299 | mstore(0x80, p3) |
| 8300 | } |
| 8301 | _sendLogPayload(0x1c, 0x84); |
| 8302 | /// @solidity memory-safe-assembly |
| 8303 | assembly { |
| 8304 | mstore(0x00, m0) |
| 8305 | mstore(0x20, m1) |
| 8306 | mstore(0x40, m2) |
| 8307 | mstore(0x60, m3) |
| 8308 | mstore(0x80, m4) |
| 8309 | } |
| 8310 | } |
| 8311 | |
| 8312 | function log(uint256 p0, address p1, bool p2, bool p3) internal pure { |
| 8313 | bytes32 m0; |
| 8314 | bytes32 m1; |
| 8315 | bytes32 m2; |
| 8316 | bytes32 m3; |
| 8317 | bytes32 m4; |
| 8318 | /// @solidity memory-safe-assembly |
| 8319 | assembly { |
| 8320 | m0 := mload(0x00) |
| 8321 | m1 := mload(0x20) |
| 8322 | m2 := mload(0x40) |
| 8323 | m3 := mload(0x60) |
| 8324 | m4 := mload(0x80) |
| 8325 | // Selector of `log(uint256,address,bool,bool)`. |
| 8326 | mstore(0x00, 0xe351140f) |
| 8327 | mstore(0x20, p0) |
| 8328 | mstore(0x40, p1) |
| 8329 | mstore(0x60, p2) |
| 8330 | mstore(0x80, p3) |
| 8331 | } |
| 8332 | _sendLogPayload(0x1c, 0x84); |
| 8333 | /// @solidity memory-safe-assembly |
| 8334 | assembly { |
| 8335 | mstore(0x00, m0) |
| 8336 | mstore(0x20, m1) |
| 8337 | mstore(0x40, m2) |
| 8338 | mstore(0x60, m3) |
| 8339 | mstore(0x80, m4) |
| 8340 | } |
| 8341 | } |
| 8342 | |
| 8343 | function log(uint256 p0, address p1, bool p2, uint256 p3) internal pure { |
| 8344 | bytes32 m0; |
| 8345 | bytes32 m1; |
| 8346 | bytes32 m2; |
| 8347 | bytes32 m3; |
| 8348 | bytes32 m4; |
| 8349 | /// @solidity memory-safe-assembly |
| 8350 | assembly { |
| 8351 | m0 := mload(0x00) |
| 8352 | m1 := mload(0x20) |
| 8353 | m2 := mload(0x40) |
| 8354 | m3 := mload(0x60) |
| 8355 | m4 := mload(0x80) |
| 8356 | // Selector of `log(uint256,address,bool,uint256)`. |
| 8357 | mstore(0x00, 0x5abd992a) |
| 8358 | mstore(0x20, p0) |
| 8359 | mstore(0x40, p1) |
| 8360 | mstore(0x60, p2) |
| 8361 | mstore(0x80, p3) |
| 8362 | } |
| 8363 | _sendLogPayload(0x1c, 0x84); |
| 8364 | /// @solidity memory-safe-assembly |
| 8365 | assembly { |
| 8366 | mstore(0x00, m0) |
| 8367 | mstore(0x20, m1) |
| 8368 | mstore(0x40, m2) |
| 8369 | mstore(0x60, m3) |
| 8370 | mstore(0x80, m4) |
| 8371 | } |
| 8372 | } |
| 8373 | |
| 8374 | function log(uint256 p0, address p1, bool p2, bytes32 p3) internal pure { |
| 8375 | bytes32 m0; |
| 8376 | bytes32 m1; |
| 8377 | bytes32 m2; |
| 8378 | bytes32 m3; |
| 8379 | bytes32 m4; |
| 8380 | bytes32 m5; |
| 8381 | bytes32 m6; |
| 8382 | /// @solidity memory-safe-assembly |
| 8383 | assembly { |
| 8384 | function writeString(pos, w) { |
| 8385 | let length := 0 |
| 8386 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 8387 | mstore(pos, length) |
| 8388 | let shift := sub(256, shl(3, length)) |
| 8389 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 8390 | } |
| 8391 | m0 := mload(0x00) |
| 8392 | m1 := mload(0x20) |
| 8393 | m2 := mload(0x40) |
| 8394 | m3 := mload(0x60) |
| 8395 | m4 := mload(0x80) |
| 8396 | m5 := mload(0xa0) |
| 8397 | m6 := mload(0xc0) |
| 8398 | // Selector of `log(uint256,address,bool,string)`. |
| 8399 | mstore(0x00, 0x90fb06aa) |
| 8400 | mstore(0x20, p0) |
| 8401 | mstore(0x40, p1) |
| 8402 | mstore(0x60, p2) |
| 8403 | mstore(0x80, 0x80) |
| 8404 | writeString(0xa0, p3) |
| 8405 | } |
| 8406 | _sendLogPayload(0x1c, 0xc4); |
| 8407 | /// @solidity memory-safe-assembly |
| 8408 | assembly { |
| 8409 | mstore(0x00, m0) |
| 8410 | mstore(0x20, m1) |
| 8411 | mstore(0x40, m2) |
| 8412 | mstore(0x60, m3) |
| 8413 | mstore(0x80, m4) |
| 8414 | mstore(0xa0, m5) |
| 8415 | mstore(0xc0, m6) |
| 8416 | } |
| 8417 | } |
| 8418 | |
| 8419 | function log(uint256 p0, address p1, uint256 p2, address p3) internal pure { |
| 8420 | bytes32 m0; |
| 8421 | bytes32 m1; |
| 8422 | bytes32 m2; |
| 8423 | bytes32 m3; |
| 8424 | bytes32 m4; |
| 8425 | /// @solidity memory-safe-assembly |
| 8426 | assembly { |
| 8427 | m0 := mload(0x00) |
| 8428 | m1 := mload(0x20) |
| 8429 | m2 := mload(0x40) |
| 8430 | m3 := mload(0x60) |
| 8431 | m4 := mload(0x80) |
| 8432 | // Selector of `log(uint256,address,uint256,address)`. |
| 8433 | mstore(0x00, 0x15c127b5) |
| 8434 | mstore(0x20, p0) |
| 8435 | mstore(0x40, p1) |
| 8436 | mstore(0x60, p2) |
| 8437 | mstore(0x80, p3) |
| 8438 | } |
| 8439 | _sendLogPayload(0x1c, 0x84); |
| 8440 | /// @solidity memory-safe-assembly |
| 8441 | assembly { |
| 8442 | mstore(0x00, m0) |
| 8443 | mstore(0x20, m1) |
| 8444 | mstore(0x40, m2) |
| 8445 | mstore(0x60, m3) |
| 8446 | mstore(0x80, m4) |
| 8447 | } |
| 8448 | } |
| 8449 | |
| 8450 | function log(uint256 p0, address p1, uint256 p2, bool p3) internal pure { |
| 8451 | bytes32 m0; |
| 8452 | bytes32 m1; |
| 8453 | bytes32 m2; |
| 8454 | bytes32 m3; |
| 8455 | bytes32 m4; |
| 8456 | /// @solidity memory-safe-assembly |
| 8457 | assembly { |
| 8458 | m0 := mload(0x00) |
| 8459 | m1 := mload(0x20) |
| 8460 | m2 := mload(0x40) |
| 8461 | m3 := mload(0x60) |
| 8462 | m4 := mload(0x80) |
| 8463 | // Selector of `log(uint256,address,uint256,bool)`. |
| 8464 | mstore(0x00, 0x5f743a7c) |
| 8465 | mstore(0x20, p0) |
| 8466 | mstore(0x40, p1) |
| 8467 | mstore(0x60, p2) |
| 8468 | mstore(0x80, p3) |
| 8469 | } |
| 8470 | _sendLogPayload(0x1c, 0x84); |
| 8471 | /// @solidity memory-safe-assembly |
| 8472 | assembly { |
| 8473 | mstore(0x00, m0) |
| 8474 | mstore(0x20, m1) |
| 8475 | mstore(0x40, m2) |
| 8476 | mstore(0x60, m3) |
| 8477 | mstore(0x80, m4) |
| 8478 | } |
| 8479 | } |
| 8480 | |
| 8481 | function log(uint256 p0, address p1, uint256 p2, uint256 p3) internal pure { |
| 8482 | bytes32 m0; |
| 8483 | bytes32 m1; |
| 8484 | bytes32 m2; |
| 8485 | bytes32 m3; |
| 8486 | bytes32 m4; |
| 8487 | /// @solidity memory-safe-assembly |
| 8488 | assembly { |
| 8489 | m0 := mload(0x00) |
| 8490 | m1 := mload(0x20) |
| 8491 | m2 := mload(0x40) |
| 8492 | m3 := mload(0x60) |
| 8493 | m4 := mload(0x80) |
| 8494 | // Selector of `log(uint256,address,uint256,uint256)`. |
| 8495 | mstore(0x00, 0x0c9cd9c1) |
| 8496 | mstore(0x20, p0) |
| 8497 | mstore(0x40, p1) |
| 8498 | mstore(0x60, p2) |
| 8499 | mstore(0x80, p3) |
| 8500 | } |
| 8501 | _sendLogPayload(0x1c, 0x84); |
| 8502 | /// @solidity memory-safe-assembly |
| 8503 | assembly { |
| 8504 | mstore(0x00, m0) |
| 8505 | mstore(0x20, m1) |
| 8506 | mstore(0x40, m2) |
| 8507 | mstore(0x60, m3) |
| 8508 | mstore(0x80, m4) |
| 8509 | } |
| 8510 | } |
| 8511 | |
| 8512 | function log(uint256 p0, address p1, uint256 p2, bytes32 p3) internal pure { |
| 8513 | bytes32 m0; |
| 8514 | bytes32 m1; |
| 8515 | bytes32 m2; |
| 8516 | bytes32 m3; |
| 8517 | bytes32 m4; |
| 8518 | bytes32 m5; |
| 8519 | bytes32 m6; |
| 8520 | /// @solidity memory-safe-assembly |
| 8521 | assembly { |
| 8522 | function writeString(pos, w) { |
| 8523 | let length := 0 |
| 8524 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 8525 | mstore(pos, length) |
| 8526 | let shift := sub(256, shl(3, length)) |
| 8527 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 8528 | } |
| 8529 | m0 := mload(0x00) |
| 8530 | m1 := mload(0x20) |
| 8531 | m2 := mload(0x40) |
| 8532 | m3 := mload(0x60) |
| 8533 | m4 := mload(0x80) |
| 8534 | m5 := mload(0xa0) |
| 8535 | m6 := mload(0xc0) |
| 8536 | // Selector of `log(uint256,address,uint256,string)`. |
| 8537 | mstore(0x00, 0xddb06521) |
| 8538 | mstore(0x20, p0) |
| 8539 | mstore(0x40, p1) |
| 8540 | mstore(0x60, p2) |
| 8541 | mstore(0x80, 0x80) |
| 8542 | writeString(0xa0, p3) |
| 8543 | } |
| 8544 | _sendLogPayload(0x1c, 0xc4); |
| 8545 | /// @solidity memory-safe-assembly |
| 8546 | assembly { |
| 8547 | mstore(0x00, m0) |
| 8548 | mstore(0x20, m1) |
| 8549 | mstore(0x40, m2) |
| 8550 | mstore(0x60, m3) |
| 8551 | mstore(0x80, m4) |
| 8552 | mstore(0xa0, m5) |
| 8553 | mstore(0xc0, m6) |
| 8554 | } |
| 8555 | } |
| 8556 | |
| 8557 | function log(uint256 p0, address p1, bytes32 p2, address p3) internal pure { |
| 8558 | bytes32 m0; |
| 8559 | bytes32 m1; |
| 8560 | bytes32 m2; |
| 8561 | bytes32 m3; |
| 8562 | bytes32 m4; |
| 8563 | bytes32 m5; |
| 8564 | bytes32 m6; |
| 8565 | /// @solidity memory-safe-assembly |
| 8566 | assembly { |
| 8567 | function writeString(pos, w) { |
| 8568 | let length := 0 |
| 8569 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 8570 | mstore(pos, length) |
| 8571 | let shift := sub(256, shl(3, length)) |
| 8572 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 8573 | } |
| 8574 | m0 := mload(0x00) |
| 8575 | m1 := mload(0x20) |
| 8576 | m2 := mload(0x40) |
| 8577 | m3 := mload(0x60) |
| 8578 | m4 := mload(0x80) |
| 8579 | m5 := mload(0xa0) |
| 8580 | m6 := mload(0xc0) |
| 8581 | // Selector of `log(uint256,address,string,address)`. |
| 8582 | mstore(0x00, 0x9cba8fff) |
| 8583 | mstore(0x20, p0) |
| 8584 | mstore(0x40, p1) |
| 8585 | mstore(0x60, 0x80) |
| 8586 | mstore(0x80, p3) |
| 8587 | writeString(0xa0, p2) |
| 8588 | } |
| 8589 | _sendLogPayload(0x1c, 0xc4); |
| 8590 | /// @solidity memory-safe-assembly |
| 8591 | assembly { |
| 8592 | mstore(0x00, m0) |
| 8593 | mstore(0x20, m1) |
| 8594 | mstore(0x40, m2) |
| 8595 | mstore(0x60, m3) |
| 8596 | mstore(0x80, m4) |
| 8597 | mstore(0xa0, m5) |
| 8598 | mstore(0xc0, m6) |
| 8599 | } |
| 8600 | } |
| 8601 | |
| 8602 | function log(uint256 p0, address p1, bytes32 p2, bool p3) internal pure { |
| 8603 | bytes32 m0; |
| 8604 | bytes32 m1; |
| 8605 | bytes32 m2; |
| 8606 | bytes32 m3; |
| 8607 | bytes32 m4; |
| 8608 | bytes32 m5; |
| 8609 | bytes32 m6; |
| 8610 | /// @solidity memory-safe-assembly |
| 8611 | assembly { |
| 8612 | function writeString(pos, w) { |
| 8613 | let length := 0 |
| 8614 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 8615 | mstore(pos, length) |
| 8616 | let shift := sub(256, shl(3, length)) |
| 8617 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 8618 | } |
| 8619 | m0 := mload(0x00) |
| 8620 | m1 := mload(0x20) |
| 8621 | m2 := mload(0x40) |
| 8622 | m3 := mload(0x60) |
| 8623 | m4 := mload(0x80) |
| 8624 | m5 := mload(0xa0) |
| 8625 | m6 := mload(0xc0) |
| 8626 | // Selector of `log(uint256,address,string,bool)`. |
| 8627 | mstore(0x00, 0xcc32ab07) |
| 8628 | mstore(0x20, p0) |
| 8629 | mstore(0x40, p1) |
| 8630 | mstore(0x60, 0x80) |
| 8631 | mstore(0x80, p3) |
| 8632 | writeString(0xa0, p2) |
| 8633 | } |
| 8634 | _sendLogPayload(0x1c, 0xc4); |
| 8635 | /// @solidity memory-safe-assembly |
| 8636 | assembly { |
| 8637 | mstore(0x00, m0) |
| 8638 | mstore(0x20, m1) |
| 8639 | mstore(0x40, m2) |
| 8640 | mstore(0x60, m3) |
| 8641 | mstore(0x80, m4) |
| 8642 | mstore(0xa0, m5) |
| 8643 | mstore(0xc0, m6) |
| 8644 | } |
| 8645 | } |
| 8646 | |
| 8647 | function log(uint256 p0, address p1, bytes32 p2, uint256 p3) internal pure { |
| 8648 | bytes32 m0; |
| 8649 | bytes32 m1; |
| 8650 | bytes32 m2; |
| 8651 | bytes32 m3; |
| 8652 | bytes32 m4; |
| 8653 | bytes32 m5; |
| 8654 | bytes32 m6; |
| 8655 | /// @solidity memory-safe-assembly |
| 8656 | assembly { |
| 8657 | function writeString(pos, w) { |
| 8658 | let length := 0 |
| 8659 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 8660 | mstore(pos, length) |
| 8661 | let shift := sub(256, shl(3, length)) |
| 8662 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 8663 | } |
| 8664 | m0 := mload(0x00) |
| 8665 | m1 := mload(0x20) |
| 8666 | m2 := mload(0x40) |
| 8667 | m3 := mload(0x60) |
| 8668 | m4 := mload(0x80) |
| 8669 | m5 := mload(0xa0) |
| 8670 | m6 := mload(0xc0) |
| 8671 | // Selector of `log(uint256,address,string,uint256)`. |
| 8672 | mstore(0x00, 0x46826b5d) |
| 8673 | mstore(0x20, p0) |
| 8674 | mstore(0x40, p1) |
| 8675 | mstore(0x60, 0x80) |
| 8676 | mstore(0x80, p3) |
| 8677 | writeString(0xa0, p2) |
| 8678 | } |
| 8679 | _sendLogPayload(0x1c, 0xc4); |
| 8680 | /// @solidity memory-safe-assembly |
| 8681 | assembly { |
| 8682 | mstore(0x00, m0) |
| 8683 | mstore(0x20, m1) |
| 8684 | mstore(0x40, m2) |
| 8685 | mstore(0x60, m3) |
| 8686 | mstore(0x80, m4) |
| 8687 | mstore(0xa0, m5) |
| 8688 | mstore(0xc0, m6) |
| 8689 | } |
| 8690 | } |
| 8691 | |
| 8692 | function log(uint256 p0, address p1, bytes32 p2, bytes32 p3) internal pure { |
| 8693 | bytes32 m0; |
| 8694 | bytes32 m1; |
| 8695 | bytes32 m2; |
| 8696 | bytes32 m3; |
| 8697 | bytes32 m4; |
| 8698 | bytes32 m5; |
| 8699 | bytes32 m6; |
| 8700 | bytes32 m7; |
| 8701 | bytes32 m8; |
| 8702 | /// @solidity memory-safe-assembly |
| 8703 | assembly { |
| 8704 | function writeString(pos, w) { |
| 8705 | let length := 0 |
| 8706 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 8707 | mstore(pos, length) |
| 8708 | let shift := sub(256, shl(3, length)) |
| 8709 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 8710 | } |
| 8711 | m0 := mload(0x00) |
| 8712 | m1 := mload(0x20) |
| 8713 | m2 := mload(0x40) |
| 8714 | m3 := mload(0x60) |
| 8715 | m4 := mload(0x80) |
| 8716 | m5 := mload(0xa0) |
| 8717 | m6 := mload(0xc0) |
| 8718 | m7 := mload(0xe0) |
| 8719 | m8 := mload(0x100) |
| 8720 | // Selector of `log(uint256,address,string,string)`. |
| 8721 | mstore(0x00, 0x3e128ca3) |
| 8722 | mstore(0x20, p0) |
| 8723 | mstore(0x40, p1) |
| 8724 | mstore(0x60, 0x80) |
| 8725 | mstore(0x80, 0xc0) |
| 8726 | writeString(0xa0, p2) |
| 8727 | writeString(0xe0, p3) |
| 8728 | } |
| 8729 | _sendLogPayload(0x1c, 0x104); |
| 8730 | /// @solidity memory-safe-assembly |
| 8731 | assembly { |
| 8732 | mstore(0x00, m0) |
| 8733 | mstore(0x20, m1) |
| 8734 | mstore(0x40, m2) |
| 8735 | mstore(0x60, m3) |
| 8736 | mstore(0x80, m4) |
| 8737 | mstore(0xa0, m5) |
| 8738 | mstore(0xc0, m6) |
| 8739 | mstore(0xe0, m7) |
| 8740 | mstore(0x100, m8) |
| 8741 | } |
| 8742 | } |
| 8743 | |
| 8744 | function log(uint256 p0, bool p1, address p2, address p3) internal pure { |
| 8745 | bytes32 m0; |
| 8746 | bytes32 m1; |
| 8747 | bytes32 m2; |
| 8748 | bytes32 m3; |
| 8749 | bytes32 m4; |
| 8750 | /// @solidity memory-safe-assembly |
| 8751 | assembly { |
| 8752 | m0 := mload(0x00) |
| 8753 | m1 := mload(0x20) |
| 8754 | m2 := mload(0x40) |
| 8755 | m3 := mload(0x60) |
| 8756 | m4 := mload(0x80) |
| 8757 | // Selector of `log(uint256,bool,address,address)`. |
| 8758 | mstore(0x00, 0xa1ef4cbb) |
| 8759 | mstore(0x20, p0) |
| 8760 | mstore(0x40, p1) |
| 8761 | mstore(0x60, p2) |
| 8762 | mstore(0x80, p3) |
| 8763 | } |
| 8764 | _sendLogPayload(0x1c, 0x84); |
| 8765 | /// @solidity memory-safe-assembly |
| 8766 | assembly { |
| 8767 | mstore(0x00, m0) |
| 8768 | mstore(0x20, m1) |
| 8769 | mstore(0x40, m2) |
| 8770 | mstore(0x60, m3) |
| 8771 | mstore(0x80, m4) |
| 8772 | } |
| 8773 | } |
| 8774 | |
| 8775 | function log(uint256 p0, bool p1, address p2, bool p3) internal pure { |
| 8776 | bytes32 m0; |
| 8777 | bytes32 m1; |
| 8778 | bytes32 m2; |
| 8779 | bytes32 m3; |
| 8780 | bytes32 m4; |
| 8781 | /// @solidity memory-safe-assembly |
| 8782 | assembly { |
| 8783 | m0 := mload(0x00) |
| 8784 | m1 := mload(0x20) |
| 8785 | m2 := mload(0x40) |
| 8786 | m3 := mload(0x60) |
| 8787 | m4 := mload(0x80) |
| 8788 | // Selector of `log(uint256,bool,address,bool)`. |
| 8789 | mstore(0x00, 0x454d54a5) |
| 8790 | mstore(0x20, p0) |
| 8791 | mstore(0x40, p1) |
| 8792 | mstore(0x60, p2) |
| 8793 | mstore(0x80, p3) |
| 8794 | } |
| 8795 | _sendLogPayload(0x1c, 0x84); |
| 8796 | /// @solidity memory-safe-assembly |
| 8797 | assembly { |
| 8798 | mstore(0x00, m0) |
| 8799 | mstore(0x20, m1) |
| 8800 | mstore(0x40, m2) |
| 8801 | mstore(0x60, m3) |
| 8802 | mstore(0x80, m4) |
| 8803 | } |
| 8804 | } |
| 8805 | |
| 8806 | function log(uint256 p0, bool p1, address p2, uint256 p3) internal pure { |
| 8807 | bytes32 m0; |
| 8808 | bytes32 m1; |
| 8809 | bytes32 m2; |
| 8810 | bytes32 m3; |
| 8811 | bytes32 m4; |
| 8812 | /// @solidity memory-safe-assembly |
| 8813 | assembly { |
| 8814 | m0 := mload(0x00) |
| 8815 | m1 := mload(0x20) |
| 8816 | m2 := mload(0x40) |
| 8817 | m3 := mload(0x60) |
| 8818 | m4 := mload(0x80) |
| 8819 | // Selector of `log(uint256,bool,address,uint256)`. |
| 8820 | mstore(0x00, 0x078287f5) |
| 8821 | mstore(0x20, p0) |
| 8822 | mstore(0x40, p1) |
| 8823 | mstore(0x60, p2) |
| 8824 | mstore(0x80, p3) |
| 8825 | } |
| 8826 | _sendLogPayload(0x1c, 0x84); |
| 8827 | /// @solidity memory-safe-assembly |
| 8828 | assembly { |
| 8829 | mstore(0x00, m0) |
| 8830 | mstore(0x20, m1) |
| 8831 | mstore(0x40, m2) |
| 8832 | mstore(0x60, m3) |
| 8833 | mstore(0x80, m4) |
| 8834 | } |
| 8835 | } |
| 8836 | |
| 8837 | function log(uint256 p0, bool p1, address p2, bytes32 p3) internal pure { |
| 8838 | bytes32 m0; |
| 8839 | bytes32 m1; |
| 8840 | bytes32 m2; |
| 8841 | bytes32 m3; |
| 8842 | bytes32 m4; |
| 8843 | bytes32 m5; |
| 8844 | bytes32 m6; |
| 8845 | /// @solidity memory-safe-assembly |
| 8846 | assembly { |
| 8847 | function writeString(pos, w) { |
| 8848 | let length := 0 |
| 8849 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 8850 | mstore(pos, length) |
| 8851 | let shift := sub(256, shl(3, length)) |
| 8852 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 8853 | } |
| 8854 | m0 := mload(0x00) |
| 8855 | m1 := mload(0x20) |
| 8856 | m2 := mload(0x40) |
| 8857 | m3 := mload(0x60) |
| 8858 | m4 := mload(0x80) |
| 8859 | m5 := mload(0xa0) |
| 8860 | m6 := mload(0xc0) |
| 8861 | // Selector of `log(uint256,bool,address,string)`. |
| 8862 | mstore(0x00, 0xade052c7) |
| 8863 | mstore(0x20, p0) |
| 8864 | mstore(0x40, p1) |
| 8865 | mstore(0x60, p2) |
| 8866 | mstore(0x80, 0x80) |
| 8867 | writeString(0xa0, p3) |
| 8868 | } |
| 8869 | _sendLogPayload(0x1c, 0xc4); |
| 8870 | /// @solidity memory-safe-assembly |
| 8871 | assembly { |
| 8872 | mstore(0x00, m0) |
| 8873 | mstore(0x20, m1) |
| 8874 | mstore(0x40, m2) |
| 8875 | mstore(0x60, m3) |
| 8876 | mstore(0x80, m4) |
| 8877 | mstore(0xa0, m5) |
| 8878 | mstore(0xc0, m6) |
| 8879 | } |
| 8880 | } |
| 8881 | |
| 8882 | function log(uint256 p0, bool p1, bool p2, address p3) internal pure { |
| 8883 | bytes32 m0; |
| 8884 | bytes32 m1; |
| 8885 | bytes32 m2; |
| 8886 | bytes32 m3; |
| 8887 | bytes32 m4; |
| 8888 | /// @solidity memory-safe-assembly |
| 8889 | assembly { |
| 8890 | m0 := mload(0x00) |
| 8891 | m1 := mload(0x20) |
| 8892 | m2 := mload(0x40) |
| 8893 | m3 := mload(0x60) |
| 8894 | m4 := mload(0x80) |
| 8895 | // Selector of `log(uint256,bool,bool,address)`. |
| 8896 | mstore(0x00, 0x69640b59) |
| 8897 | mstore(0x20, p0) |
| 8898 | mstore(0x40, p1) |
| 8899 | mstore(0x60, p2) |
| 8900 | mstore(0x80, p3) |
| 8901 | } |
| 8902 | _sendLogPayload(0x1c, 0x84); |
| 8903 | /// @solidity memory-safe-assembly |
| 8904 | assembly { |
| 8905 | mstore(0x00, m0) |
| 8906 | mstore(0x20, m1) |
| 8907 | mstore(0x40, m2) |
| 8908 | mstore(0x60, m3) |
| 8909 | mstore(0x80, m4) |
| 8910 | } |
| 8911 | } |
| 8912 | |
| 8913 | function log(uint256 p0, bool p1, bool p2, bool p3) internal pure { |
| 8914 | bytes32 m0; |
| 8915 | bytes32 m1; |
| 8916 | bytes32 m2; |
| 8917 | bytes32 m3; |
| 8918 | bytes32 m4; |
| 8919 | /// @solidity memory-safe-assembly |
| 8920 | assembly { |
| 8921 | m0 := mload(0x00) |
| 8922 | m1 := mload(0x20) |
| 8923 | m2 := mload(0x40) |
| 8924 | m3 := mload(0x60) |
| 8925 | m4 := mload(0x80) |
| 8926 | // Selector of `log(uint256,bool,bool,bool)`. |
| 8927 | mstore(0x00, 0xb6f577a1) |
| 8928 | mstore(0x20, p0) |
| 8929 | mstore(0x40, p1) |
| 8930 | mstore(0x60, p2) |
| 8931 | mstore(0x80, p3) |
| 8932 | } |
| 8933 | _sendLogPayload(0x1c, 0x84); |
| 8934 | /// @solidity memory-safe-assembly |
| 8935 | assembly { |
| 8936 | mstore(0x00, m0) |
| 8937 | mstore(0x20, m1) |
| 8938 | mstore(0x40, m2) |
| 8939 | mstore(0x60, m3) |
| 8940 | mstore(0x80, m4) |
| 8941 | } |
| 8942 | } |
| 8943 | |
| 8944 | function log(uint256 p0, bool p1, bool p2, uint256 p3) internal pure { |
| 8945 | bytes32 m0; |
| 8946 | bytes32 m1; |
| 8947 | bytes32 m2; |
| 8948 | bytes32 m3; |
| 8949 | bytes32 m4; |
| 8950 | /// @solidity memory-safe-assembly |
| 8951 | assembly { |
| 8952 | m0 := mload(0x00) |
| 8953 | m1 := mload(0x20) |
| 8954 | m2 := mload(0x40) |
| 8955 | m3 := mload(0x60) |
| 8956 | m4 := mload(0x80) |
| 8957 | // Selector of `log(uint256,bool,bool,uint256)`. |
| 8958 | mstore(0x00, 0x7464ce23) |
| 8959 | mstore(0x20, p0) |
| 8960 | mstore(0x40, p1) |
| 8961 | mstore(0x60, p2) |
| 8962 | mstore(0x80, p3) |
| 8963 | } |
| 8964 | _sendLogPayload(0x1c, 0x84); |
| 8965 | /// @solidity memory-safe-assembly |
| 8966 | assembly { |
| 8967 | mstore(0x00, m0) |
| 8968 | mstore(0x20, m1) |
| 8969 | mstore(0x40, m2) |
| 8970 | mstore(0x60, m3) |
| 8971 | mstore(0x80, m4) |
| 8972 | } |
| 8973 | } |
| 8974 | |
| 8975 | function log(uint256 p0, bool p1, bool p2, bytes32 p3) internal pure { |
| 8976 | bytes32 m0; |
| 8977 | bytes32 m1; |
| 8978 | bytes32 m2; |
| 8979 | bytes32 m3; |
| 8980 | bytes32 m4; |
| 8981 | bytes32 m5; |
| 8982 | bytes32 m6; |
| 8983 | /// @solidity memory-safe-assembly |
| 8984 | assembly { |
| 8985 | function writeString(pos, w) { |
| 8986 | let length := 0 |
| 8987 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 8988 | mstore(pos, length) |
| 8989 | let shift := sub(256, shl(3, length)) |
| 8990 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 8991 | } |
| 8992 | m0 := mload(0x00) |
| 8993 | m1 := mload(0x20) |
| 8994 | m2 := mload(0x40) |
| 8995 | m3 := mload(0x60) |
| 8996 | m4 := mload(0x80) |
| 8997 | m5 := mload(0xa0) |
| 8998 | m6 := mload(0xc0) |
| 8999 | // Selector of `log(uint256,bool,bool,string)`. |
| 9000 | mstore(0x00, 0xdddb9561) |
| 9001 | mstore(0x20, p0) |
| 9002 | mstore(0x40, p1) |
| 9003 | mstore(0x60, p2) |
| 9004 | mstore(0x80, 0x80) |
| 9005 | writeString(0xa0, p3) |
| 9006 | } |
| 9007 | _sendLogPayload(0x1c, 0xc4); |
| 9008 | /// @solidity memory-safe-assembly |
| 9009 | assembly { |
| 9010 | mstore(0x00, m0) |
| 9011 | mstore(0x20, m1) |
| 9012 | mstore(0x40, m2) |
| 9013 | mstore(0x60, m3) |
| 9014 | mstore(0x80, m4) |
| 9015 | mstore(0xa0, m5) |
| 9016 | mstore(0xc0, m6) |
| 9017 | } |
| 9018 | } |
| 9019 | |
| 9020 | function log(uint256 p0, bool p1, uint256 p2, address p3) internal pure { |
| 9021 | bytes32 m0; |
| 9022 | bytes32 m1; |
| 9023 | bytes32 m2; |
| 9024 | bytes32 m3; |
| 9025 | bytes32 m4; |
| 9026 | /// @solidity memory-safe-assembly |
| 9027 | assembly { |
| 9028 | m0 := mload(0x00) |
| 9029 | m1 := mload(0x20) |
| 9030 | m2 := mload(0x40) |
| 9031 | m3 := mload(0x60) |
| 9032 | m4 := mload(0x80) |
| 9033 | // Selector of `log(uint256,bool,uint256,address)`. |
| 9034 | mstore(0x00, 0x88cb6041) |
| 9035 | mstore(0x20, p0) |
| 9036 | mstore(0x40, p1) |
| 9037 | mstore(0x60, p2) |
| 9038 | mstore(0x80, p3) |
| 9039 | } |
| 9040 | _sendLogPayload(0x1c, 0x84); |
| 9041 | /// @solidity memory-safe-assembly |
| 9042 | assembly { |
| 9043 | mstore(0x00, m0) |
| 9044 | mstore(0x20, m1) |
| 9045 | mstore(0x40, m2) |
| 9046 | mstore(0x60, m3) |
| 9047 | mstore(0x80, m4) |
| 9048 | } |
| 9049 | } |
| 9050 | |
| 9051 | function log(uint256 p0, bool p1, uint256 p2, bool p3) internal pure { |
| 9052 | bytes32 m0; |
| 9053 | bytes32 m1; |
| 9054 | bytes32 m2; |
| 9055 | bytes32 m3; |
| 9056 | bytes32 m4; |
| 9057 | /// @solidity memory-safe-assembly |
| 9058 | assembly { |
| 9059 | m0 := mload(0x00) |
| 9060 | m1 := mload(0x20) |
| 9061 | m2 := mload(0x40) |
| 9062 | m3 := mload(0x60) |
| 9063 | m4 := mload(0x80) |
| 9064 | // Selector of `log(uint256,bool,uint256,bool)`. |
| 9065 | mstore(0x00, 0x91a02e2a) |
| 9066 | mstore(0x20, p0) |
| 9067 | mstore(0x40, p1) |
| 9068 | mstore(0x60, p2) |
| 9069 | mstore(0x80, p3) |
| 9070 | } |
| 9071 | _sendLogPayload(0x1c, 0x84); |
| 9072 | /// @solidity memory-safe-assembly |
| 9073 | assembly { |
| 9074 | mstore(0x00, m0) |
| 9075 | mstore(0x20, m1) |
| 9076 | mstore(0x40, m2) |
| 9077 | mstore(0x60, m3) |
| 9078 | mstore(0x80, m4) |
| 9079 | } |
| 9080 | } |
| 9081 | |
| 9082 | function log(uint256 p0, bool p1, uint256 p2, uint256 p3) internal pure { |
| 9083 | bytes32 m0; |
| 9084 | bytes32 m1; |
| 9085 | bytes32 m2; |
| 9086 | bytes32 m3; |
| 9087 | bytes32 m4; |
| 9088 | /// @solidity memory-safe-assembly |
| 9089 | assembly { |
| 9090 | m0 := mload(0x00) |
| 9091 | m1 := mload(0x20) |
| 9092 | m2 := mload(0x40) |
| 9093 | m3 := mload(0x60) |
| 9094 | m4 := mload(0x80) |
| 9095 | // Selector of `log(uint256,bool,uint256,uint256)`. |
| 9096 | mstore(0x00, 0xc6acc7a8) |
| 9097 | mstore(0x20, p0) |
| 9098 | mstore(0x40, p1) |
| 9099 | mstore(0x60, p2) |
| 9100 | mstore(0x80, p3) |
| 9101 | } |
| 9102 | _sendLogPayload(0x1c, 0x84); |
| 9103 | /// @solidity memory-safe-assembly |
| 9104 | assembly { |
| 9105 | mstore(0x00, m0) |
| 9106 | mstore(0x20, m1) |
| 9107 | mstore(0x40, m2) |
| 9108 | mstore(0x60, m3) |
| 9109 | mstore(0x80, m4) |
| 9110 | } |
| 9111 | } |
| 9112 | |
| 9113 | function log(uint256 p0, bool p1, uint256 p2, bytes32 p3) internal pure { |
| 9114 | bytes32 m0; |
| 9115 | bytes32 m1; |
| 9116 | bytes32 m2; |
| 9117 | bytes32 m3; |
| 9118 | bytes32 m4; |
| 9119 | bytes32 m5; |
| 9120 | bytes32 m6; |
| 9121 | /// @solidity memory-safe-assembly |
| 9122 | assembly { |
| 9123 | function writeString(pos, w) { |
| 9124 | let length := 0 |
| 9125 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 9126 | mstore(pos, length) |
| 9127 | let shift := sub(256, shl(3, length)) |
| 9128 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 9129 | } |
| 9130 | m0 := mload(0x00) |
| 9131 | m1 := mload(0x20) |
| 9132 | m2 := mload(0x40) |
| 9133 | m3 := mload(0x60) |
| 9134 | m4 := mload(0x80) |
| 9135 | m5 := mload(0xa0) |
| 9136 | m6 := mload(0xc0) |
| 9137 | // Selector of `log(uint256,bool,uint256,string)`. |
| 9138 | mstore(0x00, 0xde03e774) |
| 9139 | mstore(0x20, p0) |
| 9140 | mstore(0x40, p1) |
| 9141 | mstore(0x60, p2) |
| 9142 | mstore(0x80, 0x80) |
| 9143 | writeString(0xa0, p3) |
| 9144 | } |
| 9145 | _sendLogPayload(0x1c, 0xc4); |
| 9146 | /// @solidity memory-safe-assembly |
| 9147 | assembly { |
| 9148 | mstore(0x00, m0) |
| 9149 | mstore(0x20, m1) |
| 9150 | mstore(0x40, m2) |
| 9151 | mstore(0x60, m3) |
| 9152 | mstore(0x80, m4) |
| 9153 | mstore(0xa0, m5) |
| 9154 | mstore(0xc0, m6) |
| 9155 | } |
| 9156 | } |
| 9157 | |
| 9158 | function log(uint256 p0, bool p1, bytes32 p2, address p3) internal pure { |
| 9159 | bytes32 m0; |
| 9160 | bytes32 m1; |
| 9161 | bytes32 m2; |
| 9162 | bytes32 m3; |
| 9163 | bytes32 m4; |
| 9164 | bytes32 m5; |
| 9165 | bytes32 m6; |
| 9166 | /// @solidity memory-safe-assembly |
| 9167 | assembly { |
| 9168 | function writeString(pos, w) { |
| 9169 | let length := 0 |
| 9170 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 9171 | mstore(pos, length) |
| 9172 | let shift := sub(256, shl(3, length)) |
| 9173 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 9174 | } |
| 9175 | m0 := mload(0x00) |
| 9176 | m1 := mload(0x20) |
| 9177 | m2 := mload(0x40) |
| 9178 | m3 := mload(0x60) |
| 9179 | m4 := mload(0x80) |
| 9180 | m5 := mload(0xa0) |
| 9181 | m6 := mload(0xc0) |
| 9182 | // Selector of `log(uint256,bool,string,address)`. |
| 9183 | mstore(0x00, 0xef529018) |
| 9184 | mstore(0x20, p0) |
| 9185 | mstore(0x40, p1) |
| 9186 | mstore(0x60, 0x80) |
| 9187 | mstore(0x80, p3) |
| 9188 | writeString(0xa0, p2) |
| 9189 | } |
| 9190 | _sendLogPayload(0x1c, 0xc4); |
| 9191 | /// @solidity memory-safe-assembly |
| 9192 | assembly { |
| 9193 | mstore(0x00, m0) |
| 9194 | mstore(0x20, m1) |
| 9195 | mstore(0x40, m2) |
| 9196 | mstore(0x60, m3) |
| 9197 | mstore(0x80, m4) |
| 9198 | mstore(0xa0, m5) |
| 9199 | mstore(0xc0, m6) |
| 9200 | } |
| 9201 | } |
| 9202 | |
| 9203 | function log(uint256 p0, bool p1, bytes32 p2, bool p3) internal pure { |
| 9204 | bytes32 m0; |
| 9205 | bytes32 m1; |
| 9206 | bytes32 m2; |
| 9207 | bytes32 m3; |
| 9208 | bytes32 m4; |
| 9209 | bytes32 m5; |
| 9210 | bytes32 m6; |
| 9211 | /// @solidity memory-safe-assembly |
| 9212 | assembly { |
| 9213 | function writeString(pos, w) { |
| 9214 | let length := 0 |
| 9215 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 9216 | mstore(pos, length) |
| 9217 | let shift := sub(256, shl(3, length)) |
| 9218 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 9219 | } |
| 9220 | m0 := mload(0x00) |
| 9221 | m1 := mload(0x20) |
| 9222 | m2 := mload(0x40) |
| 9223 | m3 := mload(0x60) |
| 9224 | m4 := mload(0x80) |
| 9225 | m5 := mload(0xa0) |
| 9226 | m6 := mload(0xc0) |
| 9227 | // Selector of `log(uint256,bool,string,bool)`. |
| 9228 | mstore(0x00, 0xeb928d7f) |
| 9229 | mstore(0x20, p0) |
| 9230 | mstore(0x40, p1) |
| 9231 | mstore(0x60, 0x80) |
| 9232 | mstore(0x80, p3) |
| 9233 | writeString(0xa0, p2) |
| 9234 | } |
| 9235 | _sendLogPayload(0x1c, 0xc4); |
| 9236 | /// @solidity memory-safe-assembly |
| 9237 | assembly { |
| 9238 | mstore(0x00, m0) |
| 9239 | mstore(0x20, m1) |
| 9240 | mstore(0x40, m2) |
| 9241 | mstore(0x60, m3) |
| 9242 | mstore(0x80, m4) |
| 9243 | mstore(0xa0, m5) |
| 9244 | mstore(0xc0, m6) |
| 9245 | } |
| 9246 | } |
| 9247 | |
| 9248 | function log(uint256 p0, bool p1, bytes32 p2, uint256 p3) internal pure { |
| 9249 | bytes32 m0; |
| 9250 | bytes32 m1; |
| 9251 | bytes32 m2; |
| 9252 | bytes32 m3; |
| 9253 | bytes32 m4; |
| 9254 | bytes32 m5; |
| 9255 | bytes32 m6; |
| 9256 | /// @solidity memory-safe-assembly |
| 9257 | assembly { |
| 9258 | function writeString(pos, w) { |
| 9259 | let length := 0 |
| 9260 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 9261 | mstore(pos, length) |
| 9262 | let shift := sub(256, shl(3, length)) |
| 9263 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 9264 | } |
| 9265 | m0 := mload(0x00) |
| 9266 | m1 := mload(0x20) |
| 9267 | m2 := mload(0x40) |
| 9268 | m3 := mload(0x60) |
| 9269 | m4 := mload(0x80) |
| 9270 | m5 := mload(0xa0) |
| 9271 | m6 := mload(0xc0) |
| 9272 | // Selector of `log(uint256,bool,string,uint256)`. |
| 9273 | mstore(0x00, 0x2c1d0746) |
| 9274 | mstore(0x20, p0) |
| 9275 | mstore(0x40, p1) |
| 9276 | mstore(0x60, 0x80) |
| 9277 | mstore(0x80, p3) |
| 9278 | writeString(0xa0, p2) |
| 9279 | } |
| 9280 | _sendLogPayload(0x1c, 0xc4); |
| 9281 | /// @solidity memory-safe-assembly |
| 9282 | assembly { |
| 9283 | mstore(0x00, m0) |
| 9284 | mstore(0x20, m1) |
| 9285 | mstore(0x40, m2) |
| 9286 | mstore(0x60, m3) |
| 9287 | mstore(0x80, m4) |
| 9288 | mstore(0xa0, m5) |
| 9289 | mstore(0xc0, m6) |
| 9290 | } |
| 9291 | } |
| 9292 | |
| 9293 | function log(uint256 p0, bool p1, bytes32 p2, bytes32 p3) internal pure { |
| 9294 | bytes32 m0; |
| 9295 | bytes32 m1; |
| 9296 | bytes32 m2; |
| 9297 | bytes32 m3; |
| 9298 | bytes32 m4; |
| 9299 | bytes32 m5; |
| 9300 | bytes32 m6; |
| 9301 | bytes32 m7; |
| 9302 | bytes32 m8; |
| 9303 | /// @solidity memory-safe-assembly |
| 9304 | assembly { |
| 9305 | function writeString(pos, w) { |
| 9306 | let length := 0 |
| 9307 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 9308 | mstore(pos, length) |
| 9309 | let shift := sub(256, shl(3, length)) |
| 9310 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 9311 | } |
| 9312 | m0 := mload(0x00) |
| 9313 | m1 := mload(0x20) |
| 9314 | m2 := mload(0x40) |
| 9315 | m3 := mload(0x60) |
| 9316 | m4 := mload(0x80) |
| 9317 | m5 := mload(0xa0) |
| 9318 | m6 := mload(0xc0) |
| 9319 | m7 := mload(0xe0) |
| 9320 | m8 := mload(0x100) |
| 9321 | // Selector of `log(uint256,bool,string,string)`. |
| 9322 | mstore(0x00, 0x68c8b8bd) |
| 9323 | mstore(0x20, p0) |
| 9324 | mstore(0x40, p1) |
| 9325 | mstore(0x60, 0x80) |
| 9326 | mstore(0x80, 0xc0) |
| 9327 | writeString(0xa0, p2) |
| 9328 | writeString(0xe0, p3) |
| 9329 | } |
| 9330 | _sendLogPayload(0x1c, 0x104); |
| 9331 | /// @solidity memory-safe-assembly |
| 9332 | assembly { |
| 9333 | mstore(0x00, m0) |
| 9334 | mstore(0x20, m1) |
| 9335 | mstore(0x40, m2) |
| 9336 | mstore(0x60, m3) |
| 9337 | mstore(0x80, m4) |
| 9338 | mstore(0xa0, m5) |
| 9339 | mstore(0xc0, m6) |
| 9340 | mstore(0xe0, m7) |
| 9341 | mstore(0x100, m8) |
| 9342 | } |
| 9343 | } |
| 9344 | |
| 9345 | function log(uint256 p0, uint256 p1, address p2, address p3) internal pure { |
| 9346 | bytes32 m0; |
| 9347 | bytes32 m1; |
| 9348 | bytes32 m2; |
| 9349 | bytes32 m3; |
| 9350 | bytes32 m4; |
| 9351 | /// @solidity memory-safe-assembly |
| 9352 | assembly { |
| 9353 | m0 := mload(0x00) |
| 9354 | m1 := mload(0x20) |
| 9355 | m2 := mload(0x40) |
| 9356 | m3 := mload(0x60) |
| 9357 | m4 := mload(0x80) |
| 9358 | // Selector of `log(uint256,uint256,address,address)`. |
| 9359 | mstore(0x00, 0x56a5d1b1) |
| 9360 | mstore(0x20, p0) |
| 9361 | mstore(0x40, p1) |
| 9362 | mstore(0x60, p2) |
| 9363 | mstore(0x80, p3) |
| 9364 | } |
| 9365 | _sendLogPayload(0x1c, 0x84); |
| 9366 | /// @solidity memory-safe-assembly |
| 9367 | assembly { |
| 9368 | mstore(0x00, m0) |
| 9369 | mstore(0x20, m1) |
| 9370 | mstore(0x40, m2) |
| 9371 | mstore(0x60, m3) |
| 9372 | mstore(0x80, m4) |
| 9373 | } |
| 9374 | } |
| 9375 | |
| 9376 | function log(uint256 p0, uint256 p1, address p2, bool p3) internal pure { |
| 9377 | bytes32 m0; |
| 9378 | bytes32 m1; |
| 9379 | bytes32 m2; |
| 9380 | bytes32 m3; |
| 9381 | bytes32 m4; |
| 9382 | /// @solidity memory-safe-assembly |
| 9383 | assembly { |
| 9384 | m0 := mload(0x00) |
| 9385 | m1 := mload(0x20) |
| 9386 | m2 := mload(0x40) |
| 9387 | m3 := mload(0x60) |
| 9388 | m4 := mload(0x80) |
| 9389 | // Selector of `log(uint256,uint256,address,bool)`. |
| 9390 | mstore(0x00, 0x15cac476) |
| 9391 | mstore(0x20, p0) |
| 9392 | mstore(0x40, p1) |
| 9393 | mstore(0x60, p2) |
| 9394 | mstore(0x80, p3) |
| 9395 | } |
| 9396 | _sendLogPayload(0x1c, 0x84); |
| 9397 | /// @solidity memory-safe-assembly |
| 9398 | assembly { |
| 9399 | mstore(0x00, m0) |
| 9400 | mstore(0x20, m1) |
| 9401 | mstore(0x40, m2) |
| 9402 | mstore(0x60, m3) |
| 9403 | mstore(0x80, m4) |
| 9404 | } |
| 9405 | } |
| 9406 | |
| 9407 | function log(uint256 p0, uint256 p1, address p2, uint256 p3) internal pure { |
| 9408 | bytes32 m0; |
| 9409 | bytes32 m1; |
| 9410 | bytes32 m2; |
| 9411 | bytes32 m3; |
| 9412 | bytes32 m4; |
| 9413 | /// @solidity memory-safe-assembly |
| 9414 | assembly { |
| 9415 | m0 := mload(0x00) |
| 9416 | m1 := mload(0x20) |
| 9417 | m2 := mload(0x40) |
| 9418 | m3 := mload(0x60) |
| 9419 | m4 := mload(0x80) |
| 9420 | // Selector of `log(uint256,uint256,address,uint256)`. |
| 9421 | mstore(0x00, 0x88f6e4b2) |
| 9422 | mstore(0x20, p0) |
| 9423 | mstore(0x40, p1) |
| 9424 | mstore(0x60, p2) |
| 9425 | mstore(0x80, p3) |
| 9426 | } |
| 9427 | _sendLogPayload(0x1c, 0x84); |
| 9428 | /// @solidity memory-safe-assembly |
| 9429 | assembly { |
| 9430 | mstore(0x00, m0) |
| 9431 | mstore(0x20, m1) |
| 9432 | mstore(0x40, m2) |
| 9433 | mstore(0x60, m3) |
| 9434 | mstore(0x80, m4) |
| 9435 | } |
| 9436 | } |
| 9437 | |
| 9438 | function log(uint256 p0, uint256 p1, address p2, bytes32 p3) internal pure { |
| 9439 | bytes32 m0; |
| 9440 | bytes32 m1; |
| 9441 | bytes32 m2; |
| 9442 | bytes32 m3; |
| 9443 | bytes32 m4; |
| 9444 | bytes32 m5; |
| 9445 | bytes32 m6; |
| 9446 | /// @solidity memory-safe-assembly |
| 9447 | assembly { |
| 9448 | function writeString(pos, w) { |
| 9449 | let length := 0 |
| 9450 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 9451 | mstore(pos, length) |
| 9452 | let shift := sub(256, shl(3, length)) |
| 9453 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 9454 | } |
| 9455 | m0 := mload(0x00) |
| 9456 | m1 := mload(0x20) |
| 9457 | m2 := mload(0x40) |
| 9458 | m3 := mload(0x60) |
| 9459 | m4 := mload(0x80) |
| 9460 | m5 := mload(0xa0) |
| 9461 | m6 := mload(0xc0) |
| 9462 | // Selector of `log(uint256,uint256,address,string)`. |
| 9463 | mstore(0x00, 0x6cde40b8) |
| 9464 | mstore(0x20, p0) |
| 9465 | mstore(0x40, p1) |
| 9466 | mstore(0x60, p2) |
| 9467 | mstore(0x80, 0x80) |
| 9468 | writeString(0xa0, p3) |
| 9469 | } |
| 9470 | _sendLogPayload(0x1c, 0xc4); |
| 9471 | /// @solidity memory-safe-assembly |
| 9472 | assembly { |
| 9473 | mstore(0x00, m0) |
| 9474 | mstore(0x20, m1) |
| 9475 | mstore(0x40, m2) |
| 9476 | mstore(0x60, m3) |
| 9477 | mstore(0x80, m4) |
| 9478 | mstore(0xa0, m5) |
| 9479 | mstore(0xc0, m6) |
| 9480 | } |
| 9481 | } |
| 9482 | |
| 9483 | function log(uint256 p0, uint256 p1, bool p2, address p3) internal pure { |
| 9484 | bytes32 m0; |
| 9485 | bytes32 m1; |
| 9486 | bytes32 m2; |
| 9487 | bytes32 m3; |
| 9488 | bytes32 m4; |
| 9489 | /// @solidity memory-safe-assembly |
| 9490 | assembly { |
| 9491 | m0 := mload(0x00) |
| 9492 | m1 := mload(0x20) |
| 9493 | m2 := mload(0x40) |
| 9494 | m3 := mload(0x60) |
| 9495 | m4 := mload(0x80) |
| 9496 | // Selector of `log(uint256,uint256,bool,address)`. |
| 9497 | mstore(0x00, 0x9a816a83) |
| 9498 | mstore(0x20, p0) |
| 9499 | mstore(0x40, p1) |
| 9500 | mstore(0x60, p2) |
| 9501 | mstore(0x80, p3) |
| 9502 | } |
| 9503 | _sendLogPayload(0x1c, 0x84); |
| 9504 | /// @solidity memory-safe-assembly |
| 9505 | assembly { |
| 9506 | mstore(0x00, m0) |
| 9507 | mstore(0x20, m1) |
| 9508 | mstore(0x40, m2) |
| 9509 | mstore(0x60, m3) |
| 9510 | mstore(0x80, m4) |
| 9511 | } |
| 9512 | } |
| 9513 | |
| 9514 | function log(uint256 p0, uint256 p1, bool p2, bool p3) internal pure { |
| 9515 | bytes32 m0; |
| 9516 | bytes32 m1; |
| 9517 | bytes32 m2; |
| 9518 | bytes32 m3; |
| 9519 | bytes32 m4; |
| 9520 | /// @solidity memory-safe-assembly |
| 9521 | assembly { |
| 9522 | m0 := mload(0x00) |
| 9523 | m1 := mload(0x20) |
| 9524 | m2 := mload(0x40) |
| 9525 | m3 := mload(0x60) |
| 9526 | m4 := mload(0x80) |
| 9527 | // Selector of `log(uint256,uint256,bool,bool)`. |
| 9528 | mstore(0x00, 0xab085ae6) |
| 9529 | mstore(0x20, p0) |
| 9530 | mstore(0x40, p1) |
| 9531 | mstore(0x60, p2) |
| 9532 | mstore(0x80, p3) |
| 9533 | } |
| 9534 | _sendLogPayload(0x1c, 0x84); |
| 9535 | /// @solidity memory-safe-assembly |
| 9536 | assembly { |
| 9537 | mstore(0x00, m0) |
| 9538 | mstore(0x20, m1) |
| 9539 | mstore(0x40, m2) |
| 9540 | mstore(0x60, m3) |
| 9541 | mstore(0x80, m4) |
| 9542 | } |
| 9543 | } |
| 9544 | |
| 9545 | function log(uint256 p0, uint256 p1, bool p2, uint256 p3) internal pure { |
| 9546 | bytes32 m0; |
| 9547 | bytes32 m1; |
| 9548 | bytes32 m2; |
| 9549 | bytes32 m3; |
| 9550 | bytes32 m4; |
| 9551 | /// @solidity memory-safe-assembly |
| 9552 | assembly { |
| 9553 | m0 := mload(0x00) |
| 9554 | m1 := mload(0x20) |
| 9555 | m2 := mload(0x40) |
| 9556 | m3 := mload(0x60) |
| 9557 | m4 := mload(0x80) |
| 9558 | // Selector of `log(uint256,uint256,bool,uint256)`. |
| 9559 | mstore(0x00, 0xeb7f6fd2) |
| 9560 | mstore(0x20, p0) |
| 9561 | mstore(0x40, p1) |
| 9562 | mstore(0x60, p2) |
| 9563 | mstore(0x80, p3) |
| 9564 | } |
| 9565 | _sendLogPayload(0x1c, 0x84); |
| 9566 | /// @solidity memory-safe-assembly |
| 9567 | assembly { |
| 9568 | mstore(0x00, m0) |
| 9569 | mstore(0x20, m1) |
| 9570 | mstore(0x40, m2) |
| 9571 | mstore(0x60, m3) |
| 9572 | mstore(0x80, m4) |
| 9573 | } |
| 9574 | } |
| 9575 | |
| 9576 | function log(uint256 p0, uint256 p1, bool p2, bytes32 p3) internal pure { |
| 9577 | bytes32 m0; |
| 9578 | bytes32 m1; |
| 9579 | bytes32 m2; |
| 9580 | bytes32 m3; |
| 9581 | bytes32 m4; |
| 9582 | bytes32 m5; |
| 9583 | bytes32 m6; |
| 9584 | /// @solidity memory-safe-assembly |
| 9585 | assembly { |
| 9586 | function writeString(pos, w) { |
| 9587 | let length := 0 |
| 9588 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 9589 | mstore(pos, length) |
| 9590 | let shift := sub(256, shl(3, length)) |
| 9591 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 9592 | } |
| 9593 | m0 := mload(0x00) |
| 9594 | m1 := mload(0x20) |
| 9595 | m2 := mload(0x40) |
| 9596 | m3 := mload(0x60) |
| 9597 | m4 := mload(0x80) |
| 9598 | m5 := mload(0xa0) |
| 9599 | m6 := mload(0xc0) |
| 9600 | // Selector of `log(uint256,uint256,bool,string)`. |
| 9601 | mstore(0x00, 0xa5b4fc99) |
| 9602 | mstore(0x20, p0) |
| 9603 | mstore(0x40, p1) |
| 9604 | mstore(0x60, p2) |
| 9605 | mstore(0x80, 0x80) |
| 9606 | writeString(0xa0, p3) |
| 9607 | } |
| 9608 | _sendLogPayload(0x1c, 0xc4); |
| 9609 | /// @solidity memory-safe-assembly |
| 9610 | assembly { |
| 9611 | mstore(0x00, m0) |
| 9612 | mstore(0x20, m1) |
| 9613 | mstore(0x40, m2) |
| 9614 | mstore(0x60, m3) |
| 9615 | mstore(0x80, m4) |
| 9616 | mstore(0xa0, m5) |
| 9617 | mstore(0xc0, m6) |
| 9618 | } |
| 9619 | } |
| 9620 | |
| 9621 | function log(uint256 p0, uint256 p1, uint256 p2, address p3) internal pure { |
| 9622 | bytes32 m0; |
| 9623 | bytes32 m1; |
| 9624 | bytes32 m2; |
| 9625 | bytes32 m3; |
| 9626 | bytes32 m4; |
| 9627 | /// @solidity memory-safe-assembly |
| 9628 | assembly { |
| 9629 | m0 := mload(0x00) |
| 9630 | m1 := mload(0x20) |
| 9631 | m2 := mload(0x40) |
| 9632 | m3 := mload(0x60) |
| 9633 | m4 := mload(0x80) |
| 9634 | // Selector of `log(uint256,uint256,uint256,address)`. |
| 9635 | mstore(0x00, 0xfa8185af) |
| 9636 | mstore(0x20, p0) |
| 9637 | mstore(0x40, p1) |
| 9638 | mstore(0x60, p2) |
| 9639 | mstore(0x80, p3) |
| 9640 | } |
| 9641 | _sendLogPayload(0x1c, 0x84); |
| 9642 | /// @solidity memory-safe-assembly |
| 9643 | assembly { |
| 9644 | mstore(0x00, m0) |
| 9645 | mstore(0x20, m1) |
| 9646 | mstore(0x40, m2) |
| 9647 | mstore(0x60, m3) |
| 9648 | mstore(0x80, m4) |
| 9649 | } |
| 9650 | } |
| 9651 | |
| 9652 | function log(uint256 p0, uint256 p1, uint256 p2, bool p3) internal pure { |
| 9653 | bytes32 m0; |
| 9654 | bytes32 m1; |
| 9655 | bytes32 m2; |
| 9656 | bytes32 m3; |
| 9657 | bytes32 m4; |
| 9658 | /// @solidity memory-safe-assembly |
| 9659 | assembly { |
| 9660 | m0 := mload(0x00) |
| 9661 | m1 := mload(0x20) |
| 9662 | m2 := mload(0x40) |
| 9663 | m3 := mload(0x60) |
| 9664 | m4 := mload(0x80) |
| 9665 | // Selector of `log(uint256,uint256,uint256,bool)`. |
| 9666 | mstore(0x00, 0xc598d185) |
| 9667 | mstore(0x20, p0) |
| 9668 | mstore(0x40, p1) |
| 9669 | mstore(0x60, p2) |
| 9670 | mstore(0x80, p3) |
| 9671 | } |
| 9672 | _sendLogPayload(0x1c, 0x84); |
| 9673 | /// @solidity memory-safe-assembly |
| 9674 | assembly { |
| 9675 | mstore(0x00, m0) |
| 9676 | mstore(0x20, m1) |
| 9677 | mstore(0x40, m2) |
| 9678 | mstore(0x60, m3) |
| 9679 | mstore(0x80, m4) |
| 9680 | } |
| 9681 | } |
| 9682 | |
| 9683 | function log(uint256 p0, uint256 p1, uint256 p2, uint256 p3) internal pure { |
| 9684 | bytes32 m0; |
| 9685 | bytes32 m1; |
| 9686 | bytes32 m2; |
| 9687 | bytes32 m3; |
| 9688 | bytes32 m4; |
| 9689 | /// @solidity memory-safe-assembly |
| 9690 | assembly { |
| 9691 | m0 := mload(0x00) |
| 9692 | m1 := mload(0x20) |
| 9693 | m2 := mload(0x40) |
| 9694 | m3 := mload(0x60) |
| 9695 | m4 := mload(0x80) |
| 9696 | // Selector of `log(uint256,uint256,uint256,uint256)`. |
| 9697 | mstore(0x00, 0x193fb800) |
| 9698 | mstore(0x20, p0) |
| 9699 | mstore(0x40, p1) |
| 9700 | mstore(0x60, p2) |
| 9701 | mstore(0x80, p3) |
| 9702 | } |
| 9703 | _sendLogPayload(0x1c, 0x84); |
| 9704 | /// @solidity memory-safe-assembly |
| 9705 | assembly { |
| 9706 | mstore(0x00, m0) |
| 9707 | mstore(0x20, m1) |
| 9708 | mstore(0x40, m2) |
| 9709 | mstore(0x60, m3) |
| 9710 | mstore(0x80, m4) |
| 9711 | } |
| 9712 | } |
| 9713 | |
| 9714 | function log(uint256 p0, uint256 p1, uint256 p2, bytes32 p3) internal pure { |
| 9715 | bytes32 m0; |
| 9716 | bytes32 m1; |
| 9717 | bytes32 m2; |
| 9718 | bytes32 m3; |
| 9719 | bytes32 m4; |
| 9720 | bytes32 m5; |
| 9721 | bytes32 m6; |
| 9722 | /// @solidity memory-safe-assembly |
| 9723 | assembly { |
| 9724 | function writeString(pos, w) { |
| 9725 | let length := 0 |
| 9726 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 9727 | mstore(pos, length) |
| 9728 | let shift := sub(256, shl(3, length)) |
| 9729 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 9730 | } |
| 9731 | m0 := mload(0x00) |
| 9732 | m1 := mload(0x20) |
| 9733 | m2 := mload(0x40) |
| 9734 | m3 := mload(0x60) |
| 9735 | m4 := mload(0x80) |
| 9736 | m5 := mload(0xa0) |
| 9737 | m6 := mload(0xc0) |
| 9738 | // Selector of `log(uint256,uint256,uint256,string)`. |
| 9739 | mstore(0x00, 0x59cfcbe3) |
| 9740 | mstore(0x20, p0) |
| 9741 | mstore(0x40, p1) |
| 9742 | mstore(0x60, p2) |
| 9743 | mstore(0x80, 0x80) |
| 9744 | writeString(0xa0, p3) |
| 9745 | } |
| 9746 | _sendLogPayload(0x1c, 0xc4); |
| 9747 | /// @solidity memory-safe-assembly |
| 9748 | assembly { |
| 9749 | mstore(0x00, m0) |
| 9750 | mstore(0x20, m1) |
| 9751 | mstore(0x40, m2) |
| 9752 | mstore(0x60, m3) |
| 9753 | mstore(0x80, m4) |
| 9754 | mstore(0xa0, m5) |
| 9755 | mstore(0xc0, m6) |
| 9756 | } |
| 9757 | } |
| 9758 | |
| 9759 | function log(uint256 p0, uint256 p1, bytes32 p2, address p3) internal pure { |
| 9760 | bytes32 m0; |
| 9761 | bytes32 m1; |
| 9762 | bytes32 m2; |
| 9763 | bytes32 m3; |
| 9764 | bytes32 m4; |
| 9765 | bytes32 m5; |
| 9766 | bytes32 m6; |
| 9767 | /// @solidity memory-safe-assembly |
| 9768 | assembly { |
| 9769 | function writeString(pos, w) { |
| 9770 | let length := 0 |
| 9771 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 9772 | mstore(pos, length) |
| 9773 | let shift := sub(256, shl(3, length)) |
| 9774 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 9775 | } |
| 9776 | m0 := mload(0x00) |
| 9777 | m1 := mload(0x20) |
| 9778 | m2 := mload(0x40) |
| 9779 | m3 := mload(0x60) |
| 9780 | m4 := mload(0x80) |
| 9781 | m5 := mload(0xa0) |
| 9782 | m6 := mload(0xc0) |
| 9783 | // Selector of `log(uint256,uint256,string,address)`. |
| 9784 | mstore(0x00, 0x42d21db7) |
| 9785 | mstore(0x20, p0) |
| 9786 | mstore(0x40, p1) |
| 9787 | mstore(0x60, 0x80) |
| 9788 | mstore(0x80, p3) |
| 9789 | writeString(0xa0, p2) |
| 9790 | } |
| 9791 | _sendLogPayload(0x1c, 0xc4); |
| 9792 | /// @solidity memory-safe-assembly |
| 9793 | assembly { |
| 9794 | mstore(0x00, m0) |
| 9795 | mstore(0x20, m1) |
| 9796 | mstore(0x40, m2) |
| 9797 | mstore(0x60, m3) |
| 9798 | mstore(0x80, m4) |
| 9799 | mstore(0xa0, m5) |
| 9800 | mstore(0xc0, m6) |
| 9801 | } |
| 9802 | } |
| 9803 | |
| 9804 | function log(uint256 p0, uint256 p1, bytes32 p2, bool p3) internal pure { |
| 9805 | bytes32 m0; |
| 9806 | bytes32 m1; |
| 9807 | bytes32 m2; |
| 9808 | bytes32 m3; |
| 9809 | bytes32 m4; |
| 9810 | bytes32 m5; |
| 9811 | bytes32 m6; |
| 9812 | /// @solidity memory-safe-assembly |
| 9813 | assembly { |
| 9814 | function writeString(pos, w) { |
| 9815 | let length := 0 |
| 9816 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 9817 | mstore(pos, length) |
| 9818 | let shift := sub(256, shl(3, length)) |
| 9819 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 9820 | } |
| 9821 | m0 := mload(0x00) |
| 9822 | m1 := mload(0x20) |
| 9823 | m2 := mload(0x40) |
| 9824 | m3 := mload(0x60) |
| 9825 | m4 := mload(0x80) |
| 9826 | m5 := mload(0xa0) |
| 9827 | m6 := mload(0xc0) |
| 9828 | // Selector of `log(uint256,uint256,string,bool)`. |
| 9829 | mstore(0x00, 0x7af6ab25) |
| 9830 | mstore(0x20, p0) |
| 9831 | mstore(0x40, p1) |
| 9832 | mstore(0x60, 0x80) |
| 9833 | mstore(0x80, p3) |
| 9834 | writeString(0xa0, p2) |
| 9835 | } |
| 9836 | _sendLogPayload(0x1c, 0xc4); |
| 9837 | /// @solidity memory-safe-assembly |
| 9838 | assembly { |
| 9839 | mstore(0x00, m0) |
| 9840 | mstore(0x20, m1) |
| 9841 | mstore(0x40, m2) |
| 9842 | mstore(0x60, m3) |
| 9843 | mstore(0x80, m4) |
| 9844 | mstore(0xa0, m5) |
| 9845 | mstore(0xc0, m6) |
| 9846 | } |
| 9847 | } |
| 9848 | |
| 9849 | function log(uint256 p0, uint256 p1, bytes32 p2, uint256 p3) internal pure { |
| 9850 | bytes32 m0; |
| 9851 | bytes32 m1; |
| 9852 | bytes32 m2; |
| 9853 | bytes32 m3; |
| 9854 | bytes32 m4; |
| 9855 | bytes32 m5; |
| 9856 | bytes32 m6; |
| 9857 | /// @solidity memory-safe-assembly |
| 9858 | assembly { |
| 9859 | function writeString(pos, w) { |
| 9860 | let length := 0 |
| 9861 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 9862 | mstore(pos, length) |
| 9863 | let shift := sub(256, shl(3, length)) |
| 9864 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 9865 | } |
| 9866 | m0 := mload(0x00) |
| 9867 | m1 := mload(0x20) |
| 9868 | m2 := mload(0x40) |
| 9869 | m3 := mload(0x60) |
| 9870 | m4 := mload(0x80) |
| 9871 | m5 := mload(0xa0) |
| 9872 | m6 := mload(0xc0) |
| 9873 | // Selector of `log(uint256,uint256,string,uint256)`. |
| 9874 | mstore(0x00, 0x5da297eb) |
| 9875 | mstore(0x20, p0) |
| 9876 | mstore(0x40, p1) |
| 9877 | mstore(0x60, 0x80) |
| 9878 | mstore(0x80, p3) |
| 9879 | writeString(0xa0, p2) |
| 9880 | } |
| 9881 | _sendLogPayload(0x1c, 0xc4); |
| 9882 | /// @solidity memory-safe-assembly |
| 9883 | assembly { |
| 9884 | mstore(0x00, m0) |
| 9885 | mstore(0x20, m1) |
| 9886 | mstore(0x40, m2) |
| 9887 | mstore(0x60, m3) |
| 9888 | mstore(0x80, m4) |
| 9889 | mstore(0xa0, m5) |
| 9890 | mstore(0xc0, m6) |
| 9891 | } |
| 9892 | } |
| 9893 | |
| 9894 | function log(uint256 p0, uint256 p1, bytes32 p2, bytes32 p3) internal pure { |
| 9895 | bytes32 m0; |
| 9896 | bytes32 m1; |
| 9897 | bytes32 m2; |
| 9898 | bytes32 m3; |
| 9899 | bytes32 m4; |
| 9900 | bytes32 m5; |
| 9901 | bytes32 m6; |
| 9902 | bytes32 m7; |
| 9903 | bytes32 m8; |
| 9904 | /// @solidity memory-safe-assembly |
| 9905 | assembly { |
| 9906 | function writeString(pos, w) { |
| 9907 | let length := 0 |
| 9908 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 9909 | mstore(pos, length) |
| 9910 | let shift := sub(256, shl(3, length)) |
| 9911 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 9912 | } |
| 9913 | m0 := mload(0x00) |
| 9914 | m1 := mload(0x20) |
| 9915 | m2 := mload(0x40) |
| 9916 | m3 := mload(0x60) |
| 9917 | m4 := mload(0x80) |
| 9918 | m5 := mload(0xa0) |
| 9919 | m6 := mload(0xc0) |
| 9920 | m7 := mload(0xe0) |
| 9921 | m8 := mload(0x100) |
| 9922 | // Selector of `log(uint256,uint256,string,string)`. |
| 9923 | mstore(0x00, 0x27d8afd2) |
| 9924 | mstore(0x20, p0) |
| 9925 | mstore(0x40, p1) |
| 9926 | mstore(0x60, 0x80) |
| 9927 | mstore(0x80, 0xc0) |
| 9928 | writeString(0xa0, p2) |
| 9929 | writeString(0xe0, p3) |
| 9930 | } |
| 9931 | _sendLogPayload(0x1c, 0x104); |
| 9932 | /// @solidity memory-safe-assembly |
| 9933 | assembly { |
| 9934 | mstore(0x00, m0) |
| 9935 | mstore(0x20, m1) |
| 9936 | mstore(0x40, m2) |
| 9937 | mstore(0x60, m3) |
| 9938 | mstore(0x80, m4) |
| 9939 | mstore(0xa0, m5) |
| 9940 | mstore(0xc0, m6) |
| 9941 | mstore(0xe0, m7) |
| 9942 | mstore(0x100, m8) |
| 9943 | } |
| 9944 | } |
| 9945 | |
| 9946 | function log(uint256 p0, bytes32 p1, address p2, address p3) internal pure { |
| 9947 | bytes32 m0; |
| 9948 | bytes32 m1; |
| 9949 | bytes32 m2; |
| 9950 | bytes32 m3; |
| 9951 | bytes32 m4; |
| 9952 | bytes32 m5; |
| 9953 | bytes32 m6; |
| 9954 | /// @solidity memory-safe-assembly |
| 9955 | assembly { |
| 9956 | function writeString(pos, w) { |
| 9957 | let length := 0 |
| 9958 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 9959 | mstore(pos, length) |
| 9960 | let shift := sub(256, shl(3, length)) |
| 9961 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 9962 | } |
| 9963 | m0 := mload(0x00) |
| 9964 | m1 := mload(0x20) |
| 9965 | m2 := mload(0x40) |
| 9966 | m3 := mload(0x60) |
| 9967 | m4 := mload(0x80) |
| 9968 | m5 := mload(0xa0) |
| 9969 | m6 := mload(0xc0) |
| 9970 | // Selector of `log(uint256,string,address,address)`. |
| 9971 | mstore(0x00, 0x6168ed61) |
| 9972 | mstore(0x20, p0) |
| 9973 | mstore(0x40, 0x80) |
| 9974 | mstore(0x60, p2) |
| 9975 | mstore(0x80, p3) |
| 9976 | writeString(0xa0, p1) |
| 9977 | } |
| 9978 | _sendLogPayload(0x1c, 0xc4); |
| 9979 | /// @solidity memory-safe-assembly |
| 9980 | assembly { |
| 9981 | mstore(0x00, m0) |
| 9982 | mstore(0x20, m1) |
| 9983 | mstore(0x40, m2) |
| 9984 | mstore(0x60, m3) |
| 9985 | mstore(0x80, m4) |
| 9986 | mstore(0xa0, m5) |
| 9987 | mstore(0xc0, m6) |
| 9988 | } |
| 9989 | } |
| 9990 | |
| 9991 | function log(uint256 p0, bytes32 p1, address p2, bool p3) internal pure { |
| 9992 | bytes32 m0; |
| 9993 | bytes32 m1; |
| 9994 | bytes32 m2; |
| 9995 | bytes32 m3; |
| 9996 | bytes32 m4; |
| 9997 | bytes32 m5; |
| 9998 | bytes32 m6; |
| 9999 | /// @solidity memory-safe-assembly |
| 10000 | assembly { |
| 10001 | function writeString(pos, w) { |
| 10002 | let length := 0 |
| 10003 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 10004 | mstore(pos, length) |
| 10005 | let shift := sub(256, shl(3, length)) |
| 10006 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 10007 | } |
| 10008 | m0 := mload(0x00) |
| 10009 | m1 := mload(0x20) |
| 10010 | m2 := mload(0x40) |
| 10011 | m3 := mload(0x60) |
| 10012 | m4 := mload(0x80) |
| 10013 | m5 := mload(0xa0) |
| 10014 | m6 := mload(0xc0) |
| 10015 | // Selector of `log(uint256,string,address,bool)`. |
| 10016 | mstore(0x00, 0x90c30a56) |
| 10017 | mstore(0x20, p0) |
| 10018 | mstore(0x40, 0x80) |
| 10019 | mstore(0x60, p2) |
| 10020 | mstore(0x80, p3) |
| 10021 | writeString(0xa0, p1) |
| 10022 | } |
| 10023 | _sendLogPayload(0x1c, 0xc4); |
| 10024 | /// @solidity memory-safe-assembly |
| 10025 | assembly { |
| 10026 | mstore(0x00, m0) |
| 10027 | mstore(0x20, m1) |
| 10028 | mstore(0x40, m2) |
| 10029 | mstore(0x60, m3) |
| 10030 | mstore(0x80, m4) |
| 10031 | mstore(0xa0, m5) |
| 10032 | mstore(0xc0, m6) |
| 10033 | } |
| 10034 | } |
| 10035 | |
| 10036 | function log(uint256 p0, bytes32 p1, address p2, uint256 p3) internal pure { |
| 10037 | bytes32 m0; |
| 10038 | bytes32 m1; |
| 10039 | bytes32 m2; |
| 10040 | bytes32 m3; |
| 10041 | bytes32 m4; |
| 10042 | bytes32 m5; |
| 10043 | bytes32 m6; |
| 10044 | /// @solidity memory-safe-assembly |
| 10045 | assembly { |
| 10046 | function writeString(pos, w) { |
| 10047 | let length := 0 |
| 10048 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 10049 | mstore(pos, length) |
| 10050 | let shift := sub(256, shl(3, length)) |
| 10051 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 10052 | } |
| 10053 | m0 := mload(0x00) |
| 10054 | m1 := mload(0x20) |
| 10055 | m2 := mload(0x40) |
| 10056 | m3 := mload(0x60) |
| 10057 | m4 := mload(0x80) |
| 10058 | m5 := mload(0xa0) |
| 10059 | m6 := mload(0xc0) |
| 10060 | // Selector of `log(uint256,string,address,uint256)`. |
| 10061 | mstore(0x00, 0xe8d3018d) |
| 10062 | mstore(0x20, p0) |
| 10063 | mstore(0x40, 0x80) |
| 10064 | mstore(0x60, p2) |
| 10065 | mstore(0x80, p3) |
| 10066 | writeString(0xa0, p1) |
| 10067 | } |
| 10068 | _sendLogPayload(0x1c, 0xc4); |
| 10069 | /// @solidity memory-safe-assembly |
| 10070 | assembly { |
| 10071 | mstore(0x00, m0) |
| 10072 | mstore(0x20, m1) |
| 10073 | mstore(0x40, m2) |
| 10074 | mstore(0x60, m3) |
| 10075 | mstore(0x80, m4) |
| 10076 | mstore(0xa0, m5) |
| 10077 | mstore(0xc0, m6) |
| 10078 | } |
| 10079 | } |
| 10080 | |
| 10081 | function log(uint256 p0, bytes32 p1, address p2, bytes32 p3) internal pure { |
| 10082 | bytes32 m0; |
| 10083 | bytes32 m1; |
| 10084 | bytes32 m2; |
| 10085 | bytes32 m3; |
| 10086 | bytes32 m4; |
| 10087 | bytes32 m5; |
| 10088 | bytes32 m6; |
| 10089 | bytes32 m7; |
| 10090 | bytes32 m8; |
| 10091 | /// @solidity memory-safe-assembly |
| 10092 | assembly { |
| 10093 | function writeString(pos, w) { |
| 10094 | let length := 0 |
| 10095 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 10096 | mstore(pos, length) |
| 10097 | let shift := sub(256, shl(3, length)) |
| 10098 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 10099 | } |
| 10100 | m0 := mload(0x00) |
| 10101 | m1 := mload(0x20) |
| 10102 | m2 := mload(0x40) |
| 10103 | m3 := mload(0x60) |
| 10104 | m4 := mload(0x80) |
| 10105 | m5 := mload(0xa0) |
| 10106 | m6 := mload(0xc0) |
| 10107 | m7 := mload(0xe0) |
| 10108 | m8 := mload(0x100) |
| 10109 | // Selector of `log(uint256,string,address,string)`. |
| 10110 | mstore(0x00, 0x9c3adfa1) |
| 10111 | mstore(0x20, p0) |
| 10112 | mstore(0x40, 0x80) |
| 10113 | mstore(0x60, p2) |
| 10114 | mstore(0x80, 0xc0) |
| 10115 | writeString(0xa0, p1) |
| 10116 | writeString(0xe0, p3) |
| 10117 | } |
| 10118 | _sendLogPayload(0x1c, 0x104); |
| 10119 | /// @solidity memory-safe-assembly |
| 10120 | assembly { |
| 10121 | mstore(0x00, m0) |
| 10122 | mstore(0x20, m1) |
| 10123 | mstore(0x40, m2) |
| 10124 | mstore(0x60, m3) |
| 10125 | mstore(0x80, m4) |
| 10126 | mstore(0xa0, m5) |
| 10127 | mstore(0xc0, m6) |
| 10128 | mstore(0xe0, m7) |
| 10129 | mstore(0x100, m8) |
| 10130 | } |
| 10131 | } |
| 10132 | |
| 10133 | function log(uint256 p0, bytes32 p1, bool p2, address p3) internal pure { |
| 10134 | bytes32 m0; |
| 10135 | bytes32 m1; |
| 10136 | bytes32 m2; |
| 10137 | bytes32 m3; |
| 10138 | bytes32 m4; |
| 10139 | bytes32 m5; |
| 10140 | bytes32 m6; |
| 10141 | /// @solidity memory-safe-assembly |
| 10142 | assembly { |
| 10143 | function writeString(pos, w) { |
| 10144 | let length := 0 |
| 10145 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 10146 | mstore(pos, length) |
| 10147 | let shift := sub(256, shl(3, length)) |
| 10148 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 10149 | } |
| 10150 | m0 := mload(0x00) |
| 10151 | m1 := mload(0x20) |
| 10152 | m2 := mload(0x40) |
| 10153 | m3 := mload(0x60) |
| 10154 | m4 := mload(0x80) |
| 10155 | m5 := mload(0xa0) |
| 10156 | m6 := mload(0xc0) |
| 10157 | // Selector of `log(uint256,string,bool,address)`. |
| 10158 | mstore(0x00, 0xae2ec581) |
| 10159 | mstore(0x20, p0) |
| 10160 | mstore(0x40, 0x80) |
| 10161 | mstore(0x60, p2) |
| 10162 | mstore(0x80, p3) |
| 10163 | writeString(0xa0, p1) |
| 10164 | } |
| 10165 | _sendLogPayload(0x1c, 0xc4); |
| 10166 | /// @solidity memory-safe-assembly |
| 10167 | assembly { |
| 10168 | mstore(0x00, m0) |
| 10169 | mstore(0x20, m1) |
| 10170 | mstore(0x40, m2) |
| 10171 | mstore(0x60, m3) |
| 10172 | mstore(0x80, m4) |
| 10173 | mstore(0xa0, m5) |
| 10174 | mstore(0xc0, m6) |
| 10175 | } |
| 10176 | } |
| 10177 | |
| 10178 | function log(uint256 p0, bytes32 p1, bool p2, bool p3) internal pure { |
| 10179 | bytes32 m0; |
| 10180 | bytes32 m1; |
| 10181 | bytes32 m2; |
| 10182 | bytes32 m3; |
| 10183 | bytes32 m4; |
| 10184 | bytes32 m5; |
| 10185 | bytes32 m6; |
| 10186 | /// @solidity memory-safe-assembly |
| 10187 | assembly { |
| 10188 | function writeString(pos, w) { |
| 10189 | let length := 0 |
| 10190 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 10191 | mstore(pos, length) |
| 10192 | let shift := sub(256, shl(3, length)) |
| 10193 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 10194 | } |
| 10195 | m0 := mload(0x00) |
| 10196 | m1 := mload(0x20) |
| 10197 | m2 := mload(0x40) |
| 10198 | m3 := mload(0x60) |
| 10199 | m4 := mload(0x80) |
| 10200 | m5 := mload(0xa0) |
| 10201 | m6 := mload(0xc0) |
| 10202 | // Selector of `log(uint256,string,bool,bool)`. |
| 10203 | mstore(0x00, 0xba535d9c) |
| 10204 | mstore(0x20, p0) |
| 10205 | mstore(0x40, 0x80) |
| 10206 | mstore(0x60, p2) |
| 10207 | mstore(0x80, p3) |
| 10208 | writeString(0xa0, p1) |
| 10209 | } |
| 10210 | _sendLogPayload(0x1c, 0xc4); |
| 10211 | /// @solidity memory-safe-assembly |
| 10212 | assembly { |
| 10213 | mstore(0x00, m0) |
| 10214 | mstore(0x20, m1) |
| 10215 | mstore(0x40, m2) |
| 10216 | mstore(0x60, m3) |
| 10217 | mstore(0x80, m4) |
| 10218 | mstore(0xa0, m5) |
| 10219 | mstore(0xc0, m6) |
| 10220 | } |
| 10221 | } |
| 10222 | |
| 10223 | function log(uint256 p0, bytes32 p1, bool p2, uint256 p3) internal pure { |
| 10224 | bytes32 m0; |
| 10225 | bytes32 m1; |
| 10226 | bytes32 m2; |
| 10227 | bytes32 m3; |
| 10228 | bytes32 m4; |
| 10229 | bytes32 m5; |
| 10230 | bytes32 m6; |
| 10231 | /// @solidity memory-safe-assembly |
| 10232 | assembly { |
| 10233 | function writeString(pos, w) { |
| 10234 | let length := 0 |
| 10235 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 10236 | mstore(pos, length) |
| 10237 | let shift := sub(256, shl(3, length)) |
| 10238 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 10239 | } |
| 10240 | m0 := mload(0x00) |
| 10241 | m1 := mload(0x20) |
| 10242 | m2 := mload(0x40) |
| 10243 | m3 := mload(0x60) |
| 10244 | m4 := mload(0x80) |
| 10245 | m5 := mload(0xa0) |
| 10246 | m6 := mload(0xc0) |
| 10247 | // Selector of `log(uint256,string,bool,uint256)`. |
| 10248 | mstore(0x00, 0xcf009880) |
| 10249 | mstore(0x20, p0) |
| 10250 | mstore(0x40, 0x80) |
| 10251 | mstore(0x60, p2) |
| 10252 | mstore(0x80, p3) |
| 10253 | writeString(0xa0, p1) |
| 10254 | } |
| 10255 | _sendLogPayload(0x1c, 0xc4); |
| 10256 | /// @solidity memory-safe-assembly |
| 10257 | assembly { |
| 10258 | mstore(0x00, m0) |
| 10259 | mstore(0x20, m1) |
| 10260 | mstore(0x40, m2) |
| 10261 | mstore(0x60, m3) |
| 10262 | mstore(0x80, m4) |
| 10263 | mstore(0xa0, m5) |
| 10264 | mstore(0xc0, m6) |
| 10265 | } |
| 10266 | } |
| 10267 | |
| 10268 | function log(uint256 p0, bytes32 p1, bool p2, bytes32 p3) internal pure { |
| 10269 | bytes32 m0; |
| 10270 | bytes32 m1; |
| 10271 | bytes32 m2; |
| 10272 | bytes32 m3; |
| 10273 | bytes32 m4; |
| 10274 | bytes32 m5; |
| 10275 | bytes32 m6; |
| 10276 | bytes32 m7; |
| 10277 | bytes32 m8; |
| 10278 | /// @solidity memory-safe-assembly |
| 10279 | assembly { |
| 10280 | function writeString(pos, w) { |
| 10281 | let length := 0 |
| 10282 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 10283 | mstore(pos, length) |
| 10284 | let shift := sub(256, shl(3, length)) |
| 10285 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 10286 | } |
| 10287 | m0 := mload(0x00) |
| 10288 | m1 := mload(0x20) |
| 10289 | m2 := mload(0x40) |
| 10290 | m3 := mload(0x60) |
| 10291 | m4 := mload(0x80) |
| 10292 | m5 := mload(0xa0) |
| 10293 | m6 := mload(0xc0) |
| 10294 | m7 := mload(0xe0) |
| 10295 | m8 := mload(0x100) |
| 10296 | // Selector of `log(uint256,string,bool,string)`. |
| 10297 | mstore(0x00, 0xd2d423cd) |
| 10298 | mstore(0x20, p0) |
| 10299 | mstore(0x40, 0x80) |
| 10300 | mstore(0x60, p2) |
| 10301 | mstore(0x80, 0xc0) |
| 10302 | writeString(0xa0, p1) |
| 10303 | writeString(0xe0, p3) |
| 10304 | } |
| 10305 | _sendLogPayload(0x1c, 0x104); |
| 10306 | /// @solidity memory-safe-assembly |
| 10307 | assembly { |
| 10308 | mstore(0x00, m0) |
| 10309 | mstore(0x20, m1) |
| 10310 | mstore(0x40, m2) |
| 10311 | mstore(0x60, m3) |
| 10312 | mstore(0x80, m4) |
| 10313 | mstore(0xa0, m5) |
| 10314 | mstore(0xc0, m6) |
| 10315 | mstore(0xe0, m7) |
| 10316 | mstore(0x100, m8) |
| 10317 | } |
| 10318 | } |
| 10319 | |
| 10320 | function log(uint256 p0, bytes32 p1, uint256 p2, address p3) internal pure { |
| 10321 | bytes32 m0; |
| 10322 | bytes32 m1; |
| 10323 | bytes32 m2; |
| 10324 | bytes32 m3; |
| 10325 | bytes32 m4; |
| 10326 | bytes32 m5; |
| 10327 | bytes32 m6; |
| 10328 | /// @solidity memory-safe-assembly |
| 10329 | assembly { |
| 10330 | function writeString(pos, w) { |
| 10331 | let length := 0 |
| 10332 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 10333 | mstore(pos, length) |
| 10334 | let shift := sub(256, shl(3, length)) |
| 10335 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 10336 | } |
| 10337 | m0 := mload(0x00) |
| 10338 | m1 := mload(0x20) |
| 10339 | m2 := mload(0x40) |
| 10340 | m3 := mload(0x60) |
| 10341 | m4 := mload(0x80) |
| 10342 | m5 := mload(0xa0) |
| 10343 | m6 := mload(0xc0) |
| 10344 | // Selector of `log(uint256,string,uint256,address)`. |
| 10345 | mstore(0x00, 0x3b2279b4) |
| 10346 | mstore(0x20, p0) |
| 10347 | mstore(0x40, 0x80) |
| 10348 | mstore(0x60, p2) |
| 10349 | mstore(0x80, p3) |
| 10350 | writeString(0xa0, p1) |
| 10351 | } |
| 10352 | _sendLogPayload(0x1c, 0xc4); |
| 10353 | /// @solidity memory-safe-assembly |
| 10354 | assembly { |
| 10355 | mstore(0x00, m0) |
| 10356 | mstore(0x20, m1) |
| 10357 | mstore(0x40, m2) |
| 10358 | mstore(0x60, m3) |
| 10359 | mstore(0x80, m4) |
| 10360 | mstore(0xa0, m5) |
| 10361 | mstore(0xc0, m6) |
| 10362 | } |
| 10363 | } |
| 10364 | |
| 10365 | function log(uint256 p0, bytes32 p1, uint256 p2, bool p3) internal pure { |
| 10366 | bytes32 m0; |
| 10367 | bytes32 m1; |
| 10368 | bytes32 m2; |
| 10369 | bytes32 m3; |
| 10370 | bytes32 m4; |
| 10371 | bytes32 m5; |
| 10372 | bytes32 m6; |
| 10373 | /// @solidity memory-safe-assembly |
| 10374 | assembly { |
| 10375 | function writeString(pos, w) { |
| 10376 | let length := 0 |
| 10377 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 10378 | mstore(pos, length) |
| 10379 | let shift := sub(256, shl(3, length)) |
| 10380 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 10381 | } |
| 10382 | m0 := mload(0x00) |
| 10383 | m1 := mload(0x20) |
| 10384 | m2 := mload(0x40) |
| 10385 | m3 := mload(0x60) |
| 10386 | m4 := mload(0x80) |
| 10387 | m5 := mload(0xa0) |
| 10388 | m6 := mload(0xc0) |
| 10389 | // Selector of `log(uint256,string,uint256,bool)`. |
| 10390 | mstore(0x00, 0x691a8f74) |
| 10391 | mstore(0x20, p0) |
| 10392 | mstore(0x40, 0x80) |
| 10393 | mstore(0x60, p2) |
| 10394 | mstore(0x80, p3) |
| 10395 | writeString(0xa0, p1) |
| 10396 | } |
| 10397 | _sendLogPayload(0x1c, 0xc4); |
| 10398 | /// @solidity memory-safe-assembly |
| 10399 | assembly { |
| 10400 | mstore(0x00, m0) |
| 10401 | mstore(0x20, m1) |
| 10402 | mstore(0x40, m2) |
| 10403 | mstore(0x60, m3) |
| 10404 | mstore(0x80, m4) |
| 10405 | mstore(0xa0, m5) |
| 10406 | mstore(0xc0, m6) |
| 10407 | } |
| 10408 | } |
| 10409 | |
| 10410 | function log(uint256 p0, bytes32 p1, uint256 p2, uint256 p3) internal pure { |
| 10411 | bytes32 m0; |
| 10412 | bytes32 m1; |
| 10413 | bytes32 m2; |
| 10414 | bytes32 m3; |
| 10415 | bytes32 m4; |
| 10416 | bytes32 m5; |
| 10417 | bytes32 m6; |
| 10418 | /// @solidity memory-safe-assembly |
| 10419 | assembly { |
| 10420 | function writeString(pos, w) { |
| 10421 | let length := 0 |
| 10422 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 10423 | mstore(pos, length) |
| 10424 | let shift := sub(256, shl(3, length)) |
| 10425 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 10426 | } |
| 10427 | m0 := mload(0x00) |
| 10428 | m1 := mload(0x20) |
| 10429 | m2 := mload(0x40) |
| 10430 | m3 := mload(0x60) |
| 10431 | m4 := mload(0x80) |
| 10432 | m5 := mload(0xa0) |
| 10433 | m6 := mload(0xc0) |
| 10434 | // Selector of `log(uint256,string,uint256,uint256)`. |
| 10435 | mstore(0x00, 0x82c25b74) |
| 10436 | mstore(0x20, p0) |
| 10437 | mstore(0x40, 0x80) |
| 10438 | mstore(0x60, p2) |
| 10439 | mstore(0x80, p3) |
| 10440 | writeString(0xa0, p1) |
| 10441 | } |
| 10442 | _sendLogPayload(0x1c, 0xc4); |
| 10443 | /// @solidity memory-safe-assembly |
| 10444 | assembly { |
| 10445 | mstore(0x00, m0) |
| 10446 | mstore(0x20, m1) |
| 10447 | mstore(0x40, m2) |
| 10448 | mstore(0x60, m3) |
| 10449 | mstore(0x80, m4) |
| 10450 | mstore(0xa0, m5) |
| 10451 | mstore(0xc0, m6) |
| 10452 | } |
| 10453 | } |
| 10454 | |
| 10455 | function log(uint256 p0, bytes32 p1, uint256 p2, bytes32 p3) internal pure { |
| 10456 | bytes32 m0; |
| 10457 | bytes32 m1; |
| 10458 | bytes32 m2; |
| 10459 | bytes32 m3; |
| 10460 | bytes32 m4; |
| 10461 | bytes32 m5; |
| 10462 | bytes32 m6; |
| 10463 | bytes32 m7; |
| 10464 | bytes32 m8; |
| 10465 | /// @solidity memory-safe-assembly |
| 10466 | assembly { |
| 10467 | function writeString(pos, w) { |
| 10468 | let length := 0 |
| 10469 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 10470 | mstore(pos, length) |
| 10471 | let shift := sub(256, shl(3, length)) |
| 10472 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 10473 | } |
| 10474 | m0 := mload(0x00) |
| 10475 | m1 := mload(0x20) |
| 10476 | m2 := mload(0x40) |
| 10477 | m3 := mload(0x60) |
| 10478 | m4 := mload(0x80) |
| 10479 | m5 := mload(0xa0) |
| 10480 | m6 := mload(0xc0) |
| 10481 | m7 := mload(0xe0) |
| 10482 | m8 := mload(0x100) |
| 10483 | // Selector of `log(uint256,string,uint256,string)`. |
| 10484 | mstore(0x00, 0xb7b914ca) |
| 10485 | mstore(0x20, p0) |
| 10486 | mstore(0x40, 0x80) |
| 10487 | mstore(0x60, p2) |
| 10488 | mstore(0x80, 0xc0) |
| 10489 | writeString(0xa0, p1) |
| 10490 | writeString(0xe0, p3) |
| 10491 | } |
| 10492 | _sendLogPayload(0x1c, 0x104); |
| 10493 | /// @solidity memory-safe-assembly |
| 10494 | assembly { |
| 10495 | mstore(0x00, m0) |
| 10496 | mstore(0x20, m1) |
| 10497 | mstore(0x40, m2) |
| 10498 | mstore(0x60, m3) |
| 10499 | mstore(0x80, m4) |
| 10500 | mstore(0xa0, m5) |
| 10501 | mstore(0xc0, m6) |
| 10502 | mstore(0xe0, m7) |
| 10503 | mstore(0x100, m8) |
| 10504 | } |
| 10505 | } |
| 10506 | |
| 10507 | function log(uint256 p0, bytes32 p1, bytes32 p2, address p3) internal pure { |
| 10508 | bytes32 m0; |
| 10509 | bytes32 m1; |
| 10510 | bytes32 m2; |
| 10511 | bytes32 m3; |
| 10512 | bytes32 m4; |
| 10513 | bytes32 m5; |
| 10514 | bytes32 m6; |
| 10515 | bytes32 m7; |
| 10516 | bytes32 m8; |
| 10517 | /// @solidity memory-safe-assembly |
| 10518 | assembly { |
| 10519 | function writeString(pos, w) { |
| 10520 | let length := 0 |
| 10521 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 10522 | mstore(pos, length) |
| 10523 | let shift := sub(256, shl(3, length)) |
| 10524 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 10525 | } |
| 10526 | m0 := mload(0x00) |
| 10527 | m1 := mload(0x20) |
| 10528 | m2 := mload(0x40) |
| 10529 | m3 := mload(0x60) |
| 10530 | m4 := mload(0x80) |
| 10531 | m5 := mload(0xa0) |
| 10532 | m6 := mload(0xc0) |
| 10533 | m7 := mload(0xe0) |
| 10534 | m8 := mload(0x100) |
| 10535 | // Selector of `log(uint256,string,string,address)`. |
| 10536 | mstore(0x00, 0xd583c602) |
| 10537 | mstore(0x20, p0) |
| 10538 | mstore(0x40, 0x80) |
| 10539 | mstore(0x60, 0xc0) |
| 10540 | mstore(0x80, p3) |
| 10541 | writeString(0xa0, p1) |
| 10542 | writeString(0xe0, p2) |
| 10543 | } |
| 10544 | _sendLogPayload(0x1c, 0x104); |
| 10545 | /// @solidity memory-safe-assembly |
| 10546 | assembly { |
| 10547 | mstore(0x00, m0) |
| 10548 | mstore(0x20, m1) |
| 10549 | mstore(0x40, m2) |
| 10550 | mstore(0x60, m3) |
| 10551 | mstore(0x80, m4) |
| 10552 | mstore(0xa0, m5) |
| 10553 | mstore(0xc0, m6) |
| 10554 | mstore(0xe0, m7) |
| 10555 | mstore(0x100, m8) |
| 10556 | } |
| 10557 | } |
| 10558 | |
| 10559 | function log(uint256 p0, bytes32 p1, bytes32 p2, bool p3) internal pure { |
| 10560 | bytes32 m0; |
| 10561 | bytes32 m1; |
| 10562 | bytes32 m2; |
| 10563 | bytes32 m3; |
| 10564 | bytes32 m4; |
| 10565 | bytes32 m5; |
| 10566 | bytes32 m6; |
| 10567 | bytes32 m7; |
| 10568 | bytes32 m8; |
| 10569 | /// @solidity memory-safe-assembly |
| 10570 | assembly { |
| 10571 | function writeString(pos, w) { |
| 10572 | let length := 0 |
| 10573 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 10574 | mstore(pos, length) |
| 10575 | let shift := sub(256, shl(3, length)) |
| 10576 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 10577 | } |
| 10578 | m0 := mload(0x00) |
| 10579 | m1 := mload(0x20) |
| 10580 | m2 := mload(0x40) |
| 10581 | m3 := mload(0x60) |
| 10582 | m4 := mload(0x80) |
| 10583 | m5 := mload(0xa0) |
| 10584 | m6 := mload(0xc0) |
| 10585 | m7 := mload(0xe0) |
| 10586 | m8 := mload(0x100) |
| 10587 | // Selector of `log(uint256,string,string,bool)`. |
| 10588 | mstore(0x00, 0xb3a6b6bd) |
| 10589 | mstore(0x20, p0) |
| 10590 | mstore(0x40, 0x80) |
| 10591 | mstore(0x60, 0xc0) |
| 10592 | mstore(0x80, p3) |
| 10593 | writeString(0xa0, p1) |
| 10594 | writeString(0xe0, p2) |
| 10595 | } |
| 10596 | _sendLogPayload(0x1c, 0x104); |
| 10597 | /// @solidity memory-safe-assembly |
| 10598 | assembly { |
| 10599 | mstore(0x00, m0) |
| 10600 | mstore(0x20, m1) |
| 10601 | mstore(0x40, m2) |
| 10602 | mstore(0x60, m3) |
| 10603 | mstore(0x80, m4) |
| 10604 | mstore(0xa0, m5) |
| 10605 | mstore(0xc0, m6) |
| 10606 | mstore(0xe0, m7) |
| 10607 | mstore(0x100, m8) |
| 10608 | } |
| 10609 | } |
| 10610 | |
| 10611 | function log(uint256 p0, bytes32 p1, bytes32 p2, uint256 p3) internal pure { |
| 10612 | bytes32 m0; |
| 10613 | bytes32 m1; |
| 10614 | bytes32 m2; |
| 10615 | bytes32 m3; |
| 10616 | bytes32 m4; |
| 10617 | bytes32 m5; |
| 10618 | bytes32 m6; |
| 10619 | bytes32 m7; |
| 10620 | bytes32 m8; |
| 10621 | /// @solidity memory-safe-assembly |
| 10622 | assembly { |
| 10623 | function writeString(pos, w) { |
| 10624 | let length := 0 |
| 10625 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 10626 | mstore(pos, length) |
| 10627 | let shift := sub(256, shl(3, length)) |
| 10628 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 10629 | } |
| 10630 | m0 := mload(0x00) |
| 10631 | m1 := mload(0x20) |
| 10632 | m2 := mload(0x40) |
| 10633 | m3 := mload(0x60) |
| 10634 | m4 := mload(0x80) |
| 10635 | m5 := mload(0xa0) |
| 10636 | m6 := mload(0xc0) |
| 10637 | m7 := mload(0xe0) |
| 10638 | m8 := mload(0x100) |
| 10639 | // Selector of `log(uint256,string,string,uint256)`. |
| 10640 | mstore(0x00, 0xb028c9bd) |
| 10641 | mstore(0x20, p0) |
| 10642 | mstore(0x40, 0x80) |
| 10643 | mstore(0x60, 0xc0) |
| 10644 | mstore(0x80, p3) |
| 10645 | writeString(0xa0, p1) |
| 10646 | writeString(0xe0, p2) |
| 10647 | } |
| 10648 | _sendLogPayload(0x1c, 0x104); |
| 10649 | /// @solidity memory-safe-assembly |
| 10650 | assembly { |
| 10651 | mstore(0x00, m0) |
| 10652 | mstore(0x20, m1) |
| 10653 | mstore(0x40, m2) |
| 10654 | mstore(0x60, m3) |
| 10655 | mstore(0x80, m4) |
| 10656 | mstore(0xa0, m5) |
| 10657 | mstore(0xc0, m6) |
| 10658 | mstore(0xe0, m7) |
| 10659 | mstore(0x100, m8) |
| 10660 | } |
| 10661 | } |
| 10662 | |
| 10663 | function log(uint256 p0, bytes32 p1, bytes32 p2, bytes32 p3) internal pure { |
| 10664 | bytes32 m0; |
| 10665 | bytes32 m1; |
| 10666 | bytes32 m2; |
| 10667 | bytes32 m3; |
| 10668 | bytes32 m4; |
| 10669 | bytes32 m5; |
| 10670 | bytes32 m6; |
| 10671 | bytes32 m7; |
| 10672 | bytes32 m8; |
| 10673 | bytes32 m9; |
| 10674 | bytes32 m10; |
| 10675 | /// @solidity memory-safe-assembly |
| 10676 | assembly { |
| 10677 | function writeString(pos, w) { |
| 10678 | let length := 0 |
| 10679 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 10680 | mstore(pos, length) |
| 10681 | let shift := sub(256, shl(3, length)) |
| 10682 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 10683 | } |
| 10684 | m0 := mload(0x00) |
| 10685 | m1 := mload(0x20) |
| 10686 | m2 := mload(0x40) |
| 10687 | m3 := mload(0x60) |
| 10688 | m4 := mload(0x80) |
| 10689 | m5 := mload(0xa0) |
| 10690 | m6 := mload(0xc0) |
| 10691 | m7 := mload(0xe0) |
| 10692 | m8 := mload(0x100) |
| 10693 | m9 := mload(0x120) |
| 10694 | m10 := mload(0x140) |
| 10695 | // Selector of `log(uint256,string,string,string)`. |
| 10696 | mstore(0x00, 0x21ad0683) |
| 10697 | mstore(0x20, p0) |
| 10698 | mstore(0x40, 0x80) |
| 10699 | mstore(0x60, 0xc0) |
| 10700 | mstore(0x80, 0x100) |
| 10701 | writeString(0xa0, p1) |
| 10702 | writeString(0xe0, p2) |
| 10703 | writeString(0x120, p3) |
| 10704 | } |
| 10705 | _sendLogPayload(0x1c, 0x144); |
| 10706 | /// @solidity memory-safe-assembly |
| 10707 | assembly { |
| 10708 | mstore(0x00, m0) |
| 10709 | mstore(0x20, m1) |
| 10710 | mstore(0x40, m2) |
| 10711 | mstore(0x60, m3) |
| 10712 | mstore(0x80, m4) |
| 10713 | mstore(0xa0, m5) |
| 10714 | mstore(0xc0, m6) |
| 10715 | mstore(0xe0, m7) |
| 10716 | mstore(0x100, m8) |
| 10717 | mstore(0x120, m9) |
| 10718 | mstore(0x140, m10) |
| 10719 | } |
| 10720 | } |
| 10721 | |
| 10722 | function log(bytes32 p0, address p1, address p2, address p3) internal pure { |
| 10723 | bytes32 m0; |
| 10724 | bytes32 m1; |
| 10725 | bytes32 m2; |
| 10726 | bytes32 m3; |
| 10727 | bytes32 m4; |
| 10728 | bytes32 m5; |
| 10729 | bytes32 m6; |
| 10730 | /// @solidity memory-safe-assembly |
| 10731 | assembly { |
| 10732 | function writeString(pos, w) { |
| 10733 | let length := 0 |
| 10734 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 10735 | mstore(pos, length) |
| 10736 | let shift := sub(256, shl(3, length)) |
| 10737 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 10738 | } |
| 10739 | m0 := mload(0x00) |
| 10740 | m1 := mload(0x20) |
| 10741 | m2 := mload(0x40) |
| 10742 | m3 := mload(0x60) |
| 10743 | m4 := mload(0x80) |
| 10744 | m5 := mload(0xa0) |
| 10745 | m6 := mload(0xc0) |
| 10746 | // Selector of `log(string,address,address,address)`. |
| 10747 | mstore(0x00, 0xed8f28f6) |
| 10748 | mstore(0x20, 0x80) |
| 10749 | mstore(0x40, p1) |
| 10750 | mstore(0x60, p2) |
| 10751 | mstore(0x80, p3) |
| 10752 | writeString(0xa0, p0) |
| 10753 | } |
| 10754 | _sendLogPayload(0x1c, 0xc4); |
| 10755 | /// @solidity memory-safe-assembly |
| 10756 | assembly { |
| 10757 | mstore(0x00, m0) |
| 10758 | mstore(0x20, m1) |
| 10759 | mstore(0x40, m2) |
| 10760 | mstore(0x60, m3) |
| 10761 | mstore(0x80, m4) |
| 10762 | mstore(0xa0, m5) |
| 10763 | mstore(0xc0, m6) |
| 10764 | } |
| 10765 | } |
| 10766 | |
| 10767 | function log(bytes32 p0, address p1, address p2, bool p3) internal pure { |
| 10768 | bytes32 m0; |
| 10769 | bytes32 m1; |
| 10770 | bytes32 m2; |
| 10771 | bytes32 m3; |
| 10772 | bytes32 m4; |
| 10773 | bytes32 m5; |
| 10774 | bytes32 m6; |
| 10775 | /// @solidity memory-safe-assembly |
| 10776 | assembly { |
| 10777 | function writeString(pos, w) { |
| 10778 | let length := 0 |
| 10779 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 10780 | mstore(pos, length) |
| 10781 | let shift := sub(256, shl(3, length)) |
| 10782 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 10783 | } |
| 10784 | m0 := mload(0x00) |
| 10785 | m1 := mload(0x20) |
| 10786 | m2 := mload(0x40) |
| 10787 | m3 := mload(0x60) |
| 10788 | m4 := mload(0x80) |
| 10789 | m5 := mload(0xa0) |
| 10790 | m6 := mload(0xc0) |
| 10791 | // Selector of `log(string,address,address,bool)`. |
| 10792 | mstore(0x00, 0xb59dbd60) |
| 10793 | mstore(0x20, 0x80) |
| 10794 | mstore(0x40, p1) |
| 10795 | mstore(0x60, p2) |
| 10796 | mstore(0x80, p3) |
| 10797 | writeString(0xa0, p0) |
| 10798 | } |
| 10799 | _sendLogPayload(0x1c, 0xc4); |
| 10800 | /// @solidity memory-safe-assembly |
| 10801 | assembly { |
| 10802 | mstore(0x00, m0) |
| 10803 | mstore(0x20, m1) |
| 10804 | mstore(0x40, m2) |
| 10805 | mstore(0x60, m3) |
| 10806 | mstore(0x80, m4) |
| 10807 | mstore(0xa0, m5) |
| 10808 | mstore(0xc0, m6) |
| 10809 | } |
| 10810 | } |
| 10811 | |
| 10812 | function log(bytes32 p0, address p1, address p2, uint256 p3) internal pure { |
| 10813 | bytes32 m0; |
| 10814 | bytes32 m1; |
| 10815 | bytes32 m2; |
| 10816 | bytes32 m3; |
| 10817 | bytes32 m4; |
| 10818 | bytes32 m5; |
| 10819 | bytes32 m6; |
| 10820 | /// @solidity memory-safe-assembly |
| 10821 | assembly { |
| 10822 | function writeString(pos, w) { |
| 10823 | let length := 0 |
| 10824 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 10825 | mstore(pos, length) |
| 10826 | let shift := sub(256, shl(3, length)) |
| 10827 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 10828 | } |
| 10829 | m0 := mload(0x00) |
| 10830 | m1 := mload(0x20) |
| 10831 | m2 := mload(0x40) |
| 10832 | m3 := mload(0x60) |
| 10833 | m4 := mload(0x80) |
| 10834 | m5 := mload(0xa0) |
| 10835 | m6 := mload(0xc0) |
| 10836 | // Selector of `log(string,address,address,uint256)`. |
| 10837 | mstore(0x00, 0x8ef3f399) |
| 10838 | mstore(0x20, 0x80) |
| 10839 | mstore(0x40, p1) |
| 10840 | mstore(0x60, p2) |
| 10841 | mstore(0x80, p3) |
| 10842 | writeString(0xa0, p0) |
| 10843 | } |
| 10844 | _sendLogPayload(0x1c, 0xc4); |
| 10845 | /// @solidity memory-safe-assembly |
| 10846 | assembly { |
| 10847 | mstore(0x00, m0) |
| 10848 | mstore(0x20, m1) |
| 10849 | mstore(0x40, m2) |
| 10850 | mstore(0x60, m3) |
| 10851 | mstore(0x80, m4) |
| 10852 | mstore(0xa0, m5) |
| 10853 | mstore(0xc0, m6) |
| 10854 | } |
| 10855 | } |
| 10856 | |
| 10857 | function log(bytes32 p0, address p1, address p2, bytes32 p3) internal pure { |
| 10858 | bytes32 m0; |
| 10859 | bytes32 m1; |
| 10860 | bytes32 m2; |
| 10861 | bytes32 m3; |
| 10862 | bytes32 m4; |
| 10863 | bytes32 m5; |
| 10864 | bytes32 m6; |
| 10865 | bytes32 m7; |
| 10866 | bytes32 m8; |
| 10867 | /// @solidity memory-safe-assembly |
| 10868 | assembly { |
| 10869 | function writeString(pos, w) { |
| 10870 | let length := 0 |
| 10871 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 10872 | mstore(pos, length) |
| 10873 | let shift := sub(256, shl(3, length)) |
| 10874 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 10875 | } |
| 10876 | m0 := mload(0x00) |
| 10877 | m1 := mload(0x20) |
| 10878 | m2 := mload(0x40) |
| 10879 | m3 := mload(0x60) |
| 10880 | m4 := mload(0x80) |
| 10881 | m5 := mload(0xa0) |
| 10882 | m6 := mload(0xc0) |
| 10883 | m7 := mload(0xe0) |
| 10884 | m8 := mload(0x100) |
| 10885 | // Selector of `log(string,address,address,string)`. |
| 10886 | mstore(0x00, 0x800a1c67) |
| 10887 | mstore(0x20, 0x80) |
| 10888 | mstore(0x40, p1) |
| 10889 | mstore(0x60, p2) |
| 10890 | mstore(0x80, 0xc0) |
| 10891 | writeString(0xa0, p0) |
| 10892 | writeString(0xe0, p3) |
| 10893 | } |
| 10894 | _sendLogPayload(0x1c, 0x104); |
| 10895 | /// @solidity memory-safe-assembly |
| 10896 | assembly { |
| 10897 | mstore(0x00, m0) |
| 10898 | mstore(0x20, m1) |
| 10899 | mstore(0x40, m2) |
| 10900 | mstore(0x60, m3) |
| 10901 | mstore(0x80, m4) |
| 10902 | mstore(0xa0, m5) |
| 10903 | mstore(0xc0, m6) |
| 10904 | mstore(0xe0, m7) |
| 10905 | mstore(0x100, m8) |
| 10906 | } |
| 10907 | } |
| 10908 | |
| 10909 | function log(bytes32 p0, address p1, bool p2, address p3) internal pure { |
| 10910 | bytes32 m0; |
| 10911 | bytes32 m1; |
| 10912 | bytes32 m2; |
| 10913 | bytes32 m3; |
| 10914 | bytes32 m4; |
| 10915 | bytes32 m5; |
| 10916 | bytes32 m6; |
| 10917 | /// @solidity memory-safe-assembly |
| 10918 | assembly { |
| 10919 | function writeString(pos, w) { |
| 10920 | let length := 0 |
| 10921 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 10922 | mstore(pos, length) |
| 10923 | let shift := sub(256, shl(3, length)) |
| 10924 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 10925 | } |
| 10926 | m0 := mload(0x00) |
| 10927 | m1 := mload(0x20) |
| 10928 | m2 := mload(0x40) |
| 10929 | m3 := mload(0x60) |
| 10930 | m4 := mload(0x80) |
| 10931 | m5 := mload(0xa0) |
| 10932 | m6 := mload(0xc0) |
| 10933 | // Selector of `log(string,address,bool,address)`. |
| 10934 | mstore(0x00, 0x223603bd) |
| 10935 | mstore(0x20, 0x80) |
| 10936 | mstore(0x40, p1) |
| 10937 | mstore(0x60, p2) |
| 10938 | mstore(0x80, p3) |
| 10939 | writeString(0xa0, p0) |
| 10940 | } |
| 10941 | _sendLogPayload(0x1c, 0xc4); |
| 10942 | /// @solidity memory-safe-assembly |
| 10943 | assembly { |
| 10944 | mstore(0x00, m0) |
| 10945 | mstore(0x20, m1) |
| 10946 | mstore(0x40, m2) |
| 10947 | mstore(0x60, m3) |
| 10948 | mstore(0x80, m4) |
| 10949 | mstore(0xa0, m5) |
| 10950 | mstore(0xc0, m6) |
| 10951 | } |
| 10952 | } |
| 10953 | |
| 10954 | function log(bytes32 p0, address p1, bool p2, bool p3) internal pure { |
| 10955 | bytes32 m0; |
| 10956 | bytes32 m1; |
| 10957 | bytes32 m2; |
| 10958 | bytes32 m3; |
| 10959 | bytes32 m4; |
| 10960 | bytes32 m5; |
| 10961 | bytes32 m6; |
| 10962 | /// @solidity memory-safe-assembly |
| 10963 | assembly { |
| 10964 | function writeString(pos, w) { |
| 10965 | let length := 0 |
| 10966 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 10967 | mstore(pos, length) |
| 10968 | let shift := sub(256, shl(3, length)) |
| 10969 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 10970 | } |
| 10971 | m0 := mload(0x00) |
| 10972 | m1 := mload(0x20) |
| 10973 | m2 := mload(0x40) |
| 10974 | m3 := mload(0x60) |
| 10975 | m4 := mload(0x80) |
| 10976 | m5 := mload(0xa0) |
| 10977 | m6 := mload(0xc0) |
| 10978 | // Selector of `log(string,address,bool,bool)`. |
| 10979 | mstore(0x00, 0x79884c2b) |
| 10980 | mstore(0x20, 0x80) |
| 10981 | mstore(0x40, p1) |
| 10982 | mstore(0x60, p2) |
| 10983 | mstore(0x80, p3) |
| 10984 | writeString(0xa0, p0) |
| 10985 | } |
| 10986 | _sendLogPayload(0x1c, 0xc4); |
| 10987 | /// @solidity memory-safe-assembly |
| 10988 | assembly { |
| 10989 | mstore(0x00, m0) |
| 10990 | mstore(0x20, m1) |
| 10991 | mstore(0x40, m2) |
| 10992 | mstore(0x60, m3) |
| 10993 | mstore(0x80, m4) |
| 10994 | mstore(0xa0, m5) |
| 10995 | mstore(0xc0, m6) |
| 10996 | } |
| 10997 | } |
| 10998 | |
| 10999 | function log(bytes32 p0, address p1, bool p2, uint256 p3) internal pure { |
| 11000 | bytes32 m0; |
| 11001 | bytes32 m1; |
| 11002 | bytes32 m2; |
| 11003 | bytes32 m3; |
| 11004 | bytes32 m4; |
| 11005 | bytes32 m5; |
| 11006 | bytes32 m6; |
| 11007 | /// @solidity memory-safe-assembly |
| 11008 | assembly { |
| 11009 | function writeString(pos, w) { |
| 11010 | let length := 0 |
| 11011 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 11012 | mstore(pos, length) |
| 11013 | let shift := sub(256, shl(3, length)) |
| 11014 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 11015 | } |
| 11016 | m0 := mload(0x00) |
| 11017 | m1 := mload(0x20) |
| 11018 | m2 := mload(0x40) |
| 11019 | m3 := mload(0x60) |
| 11020 | m4 := mload(0x80) |
| 11021 | m5 := mload(0xa0) |
| 11022 | m6 := mload(0xc0) |
| 11023 | // Selector of `log(string,address,bool,uint256)`. |
| 11024 | mstore(0x00, 0x3e9f866a) |
| 11025 | mstore(0x20, 0x80) |
| 11026 | mstore(0x40, p1) |
| 11027 | mstore(0x60, p2) |
| 11028 | mstore(0x80, p3) |
| 11029 | writeString(0xa0, p0) |
| 11030 | } |
| 11031 | _sendLogPayload(0x1c, 0xc4); |
| 11032 | /// @solidity memory-safe-assembly |
| 11033 | assembly { |
| 11034 | mstore(0x00, m0) |
| 11035 | mstore(0x20, m1) |
| 11036 | mstore(0x40, m2) |
| 11037 | mstore(0x60, m3) |
| 11038 | mstore(0x80, m4) |
| 11039 | mstore(0xa0, m5) |
| 11040 | mstore(0xc0, m6) |
| 11041 | } |
| 11042 | } |
| 11043 | |
| 11044 | function log(bytes32 p0, address p1, bool p2, bytes32 p3) internal pure { |
| 11045 | bytes32 m0; |
| 11046 | bytes32 m1; |
| 11047 | bytes32 m2; |
| 11048 | bytes32 m3; |
| 11049 | bytes32 m4; |
| 11050 | bytes32 m5; |
| 11051 | bytes32 m6; |
| 11052 | bytes32 m7; |
| 11053 | bytes32 m8; |
| 11054 | /// @solidity memory-safe-assembly |
| 11055 | assembly { |
| 11056 | function writeString(pos, w) { |
| 11057 | let length := 0 |
| 11058 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 11059 | mstore(pos, length) |
| 11060 | let shift := sub(256, shl(3, length)) |
| 11061 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 11062 | } |
| 11063 | m0 := mload(0x00) |
| 11064 | m1 := mload(0x20) |
| 11065 | m2 := mload(0x40) |
| 11066 | m3 := mload(0x60) |
| 11067 | m4 := mload(0x80) |
| 11068 | m5 := mload(0xa0) |
| 11069 | m6 := mload(0xc0) |
| 11070 | m7 := mload(0xe0) |
| 11071 | m8 := mload(0x100) |
| 11072 | // Selector of `log(string,address,bool,string)`. |
| 11073 | mstore(0x00, 0x0454c079) |
| 11074 | mstore(0x20, 0x80) |
| 11075 | mstore(0x40, p1) |
| 11076 | mstore(0x60, p2) |
| 11077 | mstore(0x80, 0xc0) |
| 11078 | writeString(0xa0, p0) |
| 11079 | writeString(0xe0, p3) |
| 11080 | } |
| 11081 | _sendLogPayload(0x1c, 0x104); |
| 11082 | /// @solidity memory-safe-assembly |
| 11083 | assembly { |
| 11084 | mstore(0x00, m0) |
| 11085 | mstore(0x20, m1) |
| 11086 | mstore(0x40, m2) |
| 11087 | mstore(0x60, m3) |
| 11088 | mstore(0x80, m4) |
| 11089 | mstore(0xa0, m5) |
| 11090 | mstore(0xc0, m6) |
| 11091 | mstore(0xe0, m7) |
| 11092 | mstore(0x100, m8) |
| 11093 | } |
| 11094 | } |
| 11095 | |
| 11096 | function log(bytes32 p0, address p1, uint256 p2, address p3) internal pure { |
| 11097 | bytes32 m0; |
| 11098 | bytes32 m1; |
| 11099 | bytes32 m2; |
| 11100 | bytes32 m3; |
| 11101 | bytes32 m4; |
| 11102 | bytes32 m5; |
| 11103 | bytes32 m6; |
| 11104 | /// @solidity memory-safe-assembly |
| 11105 | assembly { |
| 11106 | function writeString(pos, w) { |
| 11107 | let length := 0 |
| 11108 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 11109 | mstore(pos, length) |
| 11110 | let shift := sub(256, shl(3, length)) |
| 11111 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 11112 | } |
| 11113 | m0 := mload(0x00) |
| 11114 | m1 := mload(0x20) |
| 11115 | m2 := mload(0x40) |
| 11116 | m3 := mload(0x60) |
| 11117 | m4 := mload(0x80) |
| 11118 | m5 := mload(0xa0) |
| 11119 | m6 := mload(0xc0) |
| 11120 | // Selector of `log(string,address,uint256,address)`. |
| 11121 | mstore(0x00, 0x63fb8bc5) |
| 11122 | mstore(0x20, 0x80) |
| 11123 | mstore(0x40, p1) |
| 11124 | mstore(0x60, p2) |
| 11125 | mstore(0x80, p3) |
| 11126 | writeString(0xa0, p0) |
| 11127 | } |
| 11128 | _sendLogPayload(0x1c, 0xc4); |
| 11129 | /// @solidity memory-safe-assembly |
| 11130 | assembly { |
| 11131 | mstore(0x00, m0) |
| 11132 | mstore(0x20, m1) |
| 11133 | mstore(0x40, m2) |
| 11134 | mstore(0x60, m3) |
| 11135 | mstore(0x80, m4) |
| 11136 | mstore(0xa0, m5) |
| 11137 | mstore(0xc0, m6) |
| 11138 | } |
| 11139 | } |
| 11140 | |
| 11141 | function log(bytes32 p0, address p1, uint256 p2, bool p3) internal pure { |
| 11142 | bytes32 m0; |
| 11143 | bytes32 m1; |
| 11144 | bytes32 m2; |
| 11145 | bytes32 m3; |
| 11146 | bytes32 m4; |
| 11147 | bytes32 m5; |
| 11148 | bytes32 m6; |
| 11149 | /// @solidity memory-safe-assembly |
| 11150 | assembly { |
| 11151 | function writeString(pos, w) { |
| 11152 | let length := 0 |
| 11153 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 11154 | mstore(pos, length) |
| 11155 | let shift := sub(256, shl(3, length)) |
| 11156 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 11157 | } |
| 11158 | m0 := mload(0x00) |
| 11159 | m1 := mload(0x20) |
| 11160 | m2 := mload(0x40) |
| 11161 | m3 := mload(0x60) |
| 11162 | m4 := mload(0x80) |
| 11163 | m5 := mload(0xa0) |
| 11164 | m6 := mload(0xc0) |
| 11165 | // Selector of `log(string,address,uint256,bool)`. |
| 11166 | mstore(0x00, 0xfc4845f0) |
| 11167 | mstore(0x20, 0x80) |
| 11168 | mstore(0x40, p1) |
| 11169 | mstore(0x60, p2) |
| 11170 | mstore(0x80, p3) |
| 11171 | writeString(0xa0, p0) |
| 11172 | } |
| 11173 | _sendLogPayload(0x1c, 0xc4); |
| 11174 | /// @solidity memory-safe-assembly |
| 11175 | assembly { |
| 11176 | mstore(0x00, m0) |
| 11177 | mstore(0x20, m1) |
| 11178 | mstore(0x40, m2) |
| 11179 | mstore(0x60, m3) |
| 11180 | mstore(0x80, m4) |
| 11181 | mstore(0xa0, m5) |
| 11182 | mstore(0xc0, m6) |
| 11183 | } |
| 11184 | } |
| 11185 | |
| 11186 | function log(bytes32 p0, address p1, uint256 p2, uint256 p3) internal pure { |
| 11187 | bytes32 m0; |
| 11188 | bytes32 m1; |
| 11189 | bytes32 m2; |
| 11190 | bytes32 m3; |
| 11191 | bytes32 m4; |
| 11192 | bytes32 m5; |
| 11193 | bytes32 m6; |
| 11194 | /// @solidity memory-safe-assembly |
| 11195 | assembly { |
| 11196 | function writeString(pos, w) { |
| 11197 | let length := 0 |
| 11198 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 11199 | mstore(pos, length) |
| 11200 | let shift := sub(256, shl(3, length)) |
| 11201 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 11202 | } |
| 11203 | m0 := mload(0x00) |
| 11204 | m1 := mload(0x20) |
| 11205 | m2 := mload(0x40) |
| 11206 | m3 := mload(0x60) |
| 11207 | m4 := mload(0x80) |
| 11208 | m5 := mload(0xa0) |
| 11209 | m6 := mload(0xc0) |
| 11210 | // Selector of `log(string,address,uint256,uint256)`. |
| 11211 | mstore(0x00, 0xf8f51b1e) |
| 11212 | mstore(0x20, 0x80) |
| 11213 | mstore(0x40, p1) |
| 11214 | mstore(0x60, p2) |
| 11215 | mstore(0x80, p3) |
| 11216 | writeString(0xa0, p0) |
| 11217 | } |
| 11218 | _sendLogPayload(0x1c, 0xc4); |
| 11219 | /// @solidity memory-safe-assembly |
| 11220 | assembly { |
| 11221 | mstore(0x00, m0) |
| 11222 | mstore(0x20, m1) |
| 11223 | mstore(0x40, m2) |
| 11224 | mstore(0x60, m3) |
| 11225 | mstore(0x80, m4) |
| 11226 | mstore(0xa0, m5) |
| 11227 | mstore(0xc0, m6) |
| 11228 | } |
| 11229 | } |
| 11230 | |
| 11231 | function log(bytes32 p0, address p1, uint256 p2, bytes32 p3) internal pure { |
| 11232 | bytes32 m0; |
| 11233 | bytes32 m1; |
| 11234 | bytes32 m2; |
| 11235 | bytes32 m3; |
| 11236 | bytes32 m4; |
| 11237 | bytes32 m5; |
| 11238 | bytes32 m6; |
| 11239 | bytes32 m7; |
| 11240 | bytes32 m8; |
| 11241 | /// @solidity memory-safe-assembly |
| 11242 | assembly { |
| 11243 | function writeString(pos, w) { |
| 11244 | let length := 0 |
| 11245 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 11246 | mstore(pos, length) |
| 11247 | let shift := sub(256, shl(3, length)) |
| 11248 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 11249 | } |
| 11250 | m0 := mload(0x00) |
| 11251 | m1 := mload(0x20) |
| 11252 | m2 := mload(0x40) |
| 11253 | m3 := mload(0x60) |
| 11254 | m4 := mload(0x80) |
| 11255 | m5 := mload(0xa0) |
| 11256 | m6 := mload(0xc0) |
| 11257 | m7 := mload(0xe0) |
| 11258 | m8 := mload(0x100) |
| 11259 | // Selector of `log(string,address,uint256,string)`. |
| 11260 | mstore(0x00, 0x5a477632) |
| 11261 | mstore(0x20, 0x80) |
| 11262 | mstore(0x40, p1) |
| 11263 | mstore(0x60, p2) |
| 11264 | mstore(0x80, 0xc0) |
| 11265 | writeString(0xa0, p0) |
| 11266 | writeString(0xe0, p3) |
| 11267 | } |
| 11268 | _sendLogPayload(0x1c, 0x104); |
| 11269 | /// @solidity memory-safe-assembly |
| 11270 | assembly { |
| 11271 | mstore(0x00, m0) |
| 11272 | mstore(0x20, m1) |
| 11273 | mstore(0x40, m2) |
| 11274 | mstore(0x60, m3) |
| 11275 | mstore(0x80, m4) |
| 11276 | mstore(0xa0, m5) |
| 11277 | mstore(0xc0, m6) |
| 11278 | mstore(0xe0, m7) |
| 11279 | mstore(0x100, m8) |
| 11280 | } |
| 11281 | } |
| 11282 | |
| 11283 | function log(bytes32 p0, address p1, bytes32 p2, address p3) internal pure { |
| 11284 | bytes32 m0; |
| 11285 | bytes32 m1; |
| 11286 | bytes32 m2; |
| 11287 | bytes32 m3; |
| 11288 | bytes32 m4; |
| 11289 | bytes32 m5; |
| 11290 | bytes32 m6; |
| 11291 | bytes32 m7; |
| 11292 | bytes32 m8; |
| 11293 | /// @solidity memory-safe-assembly |
| 11294 | assembly { |
| 11295 | function writeString(pos, w) { |
| 11296 | let length := 0 |
| 11297 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 11298 | mstore(pos, length) |
| 11299 | let shift := sub(256, shl(3, length)) |
| 11300 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 11301 | } |
| 11302 | m0 := mload(0x00) |
| 11303 | m1 := mload(0x20) |
| 11304 | m2 := mload(0x40) |
| 11305 | m3 := mload(0x60) |
| 11306 | m4 := mload(0x80) |
| 11307 | m5 := mload(0xa0) |
| 11308 | m6 := mload(0xc0) |
| 11309 | m7 := mload(0xe0) |
| 11310 | m8 := mload(0x100) |
| 11311 | // Selector of `log(string,address,string,address)`. |
| 11312 | mstore(0x00, 0xaabc9a31) |
| 11313 | mstore(0x20, 0x80) |
| 11314 | mstore(0x40, p1) |
| 11315 | mstore(0x60, 0xc0) |
| 11316 | mstore(0x80, p3) |
| 11317 | writeString(0xa0, p0) |
| 11318 | writeString(0xe0, p2) |
| 11319 | } |
| 11320 | _sendLogPayload(0x1c, 0x104); |
| 11321 | /// @solidity memory-safe-assembly |
| 11322 | assembly { |
| 11323 | mstore(0x00, m0) |
| 11324 | mstore(0x20, m1) |
| 11325 | mstore(0x40, m2) |
| 11326 | mstore(0x60, m3) |
| 11327 | mstore(0x80, m4) |
| 11328 | mstore(0xa0, m5) |
| 11329 | mstore(0xc0, m6) |
| 11330 | mstore(0xe0, m7) |
| 11331 | mstore(0x100, m8) |
| 11332 | } |
| 11333 | } |
| 11334 | |
| 11335 | function log(bytes32 p0, address p1, bytes32 p2, bool p3) internal pure { |
| 11336 | bytes32 m0; |
| 11337 | bytes32 m1; |
| 11338 | bytes32 m2; |
| 11339 | bytes32 m3; |
| 11340 | bytes32 m4; |
| 11341 | bytes32 m5; |
| 11342 | bytes32 m6; |
| 11343 | bytes32 m7; |
| 11344 | bytes32 m8; |
| 11345 | /// @solidity memory-safe-assembly |
| 11346 | assembly { |
| 11347 | function writeString(pos, w) { |
| 11348 | let length := 0 |
| 11349 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 11350 | mstore(pos, length) |
| 11351 | let shift := sub(256, shl(3, length)) |
| 11352 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 11353 | } |
| 11354 | m0 := mload(0x00) |
| 11355 | m1 := mload(0x20) |
| 11356 | m2 := mload(0x40) |
| 11357 | m3 := mload(0x60) |
| 11358 | m4 := mload(0x80) |
| 11359 | m5 := mload(0xa0) |
| 11360 | m6 := mload(0xc0) |
| 11361 | m7 := mload(0xe0) |
| 11362 | m8 := mload(0x100) |
| 11363 | // Selector of `log(string,address,string,bool)`. |
| 11364 | mstore(0x00, 0x5f15d28c) |
| 11365 | mstore(0x20, 0x80) |
| 11366 | mstore(0x40, p1) |
| 11367 | mstore(0x60, 0xc0) |
| 11368 | mstore(0x80, p3) |
| 11369 | writeString(0xa0, p0) |
| 11370 | writeString(0xe0, p2) |
| 11371 | } |
| 11372 | _sendLogPayload(0x1c, 0x104); |
| 11373 | /// @solidity memory-safe-assembly |
| 11374 | assembly { |
| 11375 | mstore(0x00, m0) |
| 11376 | mstore(0x20, m1) |
| 11377 | mstore(0x40, m2) |
| 11378 | mstore(0x60, m3) |
| 11379 | mstore(0x80, m4) |
| 11380 | mstore(0xa0, m5) |
| 11381 | mstore(0xc0, m6) |
| 11382 | mstore(0xe0, m7) |
| 11383 | mstore(0x100, m8) |
| 11384 | } |
| 11385 | } |
| 11386 | |
| 11387 | function log(bytes32 p0, address p1, bytes32 p2, uint256 p3) internal pure { |
| 11388 | bytes32 m0; |
| 11389 | bytes32 m1; |
| 11390 | bytes32 m2; |
| 11391 | bytes32 m3; |
| 11392 | bytes32 m4; |
| 11393 | bytes32 m5; |
| 11394 | bytes32 m6; |
| 11395 | bytes32 m7; |
| 11396 | bytes32 m8; |
| 11397 | /// @solidity memory-safe-assembly |
| 11398 | assembly { |
| 11399 | function writeString(pos, w) { |
| 11400 | let length := 0 |
| 11401 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 11402 | mstore(pos, length) |
| 11403 | let shift := sub(256, shl(3, length)) |
| 11404 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 11405 | } |
| 11406 | m0 := mload(0x00) |
| 11407 | m1 := mload(0x20) |
| 11408 | m2 := mload(0x40) |
| 11409 | m3 := mload(0x60) |
| 11410 | m4 := mload(0x80) |
| 11411 | m5 := mload(0xa0) |
| 11412 | m6 := mload(0xc0) |
| 11413 | m7 := mload(0xe0) |
| 11414 | m8 := mload(0x100) |
| 11415 | // Selector of `log(string,address,string,uint256)`. |
| 11416 | mstore(0x00, 0x91d1112e) |
| 11417 | mstore(0x20, 0x80) |
| 11418 | mstore(0x40, p1) |
| 11419 | mstore(0x60, 0xc0) |
| 11420 | mstore(0x80, p3) |
| 11421 | writeString(0xa0, p0) |
| 11422 | writeString(0xe0, p2) |
| 11423 | } |
| 11424 | _sendLogPayload(0x1c, 0x104); |
| 11425 | /// @solidity memory-safe-assembly |
| 11426 | assembly { |
| 11427 | mstore(0x00, m0) |
| 11428 | mstore(0x20, m1) |
| 11429 | mstore(0x40, m2) |
| 11430 | mstore(0x60, m3) |
| 11431 | mstore(0x80, m4) |
| 11432 | mstore(0xa0, m5) |
| 11433 | mstore(0xc0, m6) |
| 11434 | mstore(0xe0, m7) |
| 11435 | mstore(0x100, m8) |
| 11436 | } |
| 11437 | } |
| 11438 | |
| 11439 | function log(bytes32 p0, address p1, bytes32 p2, bytes32 p3) internal pure { |
| 11440 | bytes32 m0; |
| 11441 | bytes32 m1; |
| 11442 | bytes32 m2; |
| 11443 | bytes32 m3; |
| 11444 | bytes32 m4; |
| 11445 | bytes32 m5; |
| 11446 | bytes32 m6; |
| 11447 | bytes32 m7; |
| 11448 | bytes32 m8; |
| 11449 | bytes32 m9; |
| 11450 | bytes32 m10; |
| 11451 | /// @solidity memory-safe-assembly |
| 11452 | assembly { |
| 11453 | function writeString(pos, w) { |
| 11454 | let length := 0 |
| 11455 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 11456 | mstore(pos, length) |
| 11457 | let shift := sub(256, shl(3, length)) |
| 11458 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 11459 | } |
| 11460 | m0 := mload(0x00) |
| 11461 | m1 := mload(0x20) |
| 11462 | m2 := mload(0x40) |
| 11463 | m3 := mload(0x60) |
| 11464 | m4 := mload(0x80) |
| 11465 | m5 := mload(0xa0) |
| 11466 | m6 := mload(0xc0) |
| 11467 | m7 := mload(0xe0) |
| 11468 | m8 := mload(0x100) |
| 11469 | m9 := mload(0x120) |
| 11470 | m10 := mload(0x140) |
| 11471 | // Selector of `log(string,address,string,string)`. |
| 11472 | mstore(0x00, 0x245986f2) |
| 11473 | mstore(0x20, 0x80) |
| 11474 | mstore(0x40, p1) |
| 11475 | mstore(0x60, 0xc0) |
| 11476 | mstore(0x80, 0x100) |
| 11477 | writeString(0xa0, p0) |
| 11478 | writeString(0xe0, p2) |
| 11479 | writeString(0x120, p3) |
| 11480 | } |
| 11481 | _sendLogPayload(0x1c, 0x144); |
| 11482 | /// @solidity memory-safe-assembly |
| 11483 | assembly { |
| 11484 | mstore(0x00, m0) |
| 11485 | mstore(0x20, m1) |
| 11486 | mstore(0x40, m2) |
| 11487 | mstore(0x60, m3) |
| 11488 | mstore(0x80, m4) |
| 11489 | mstore(0xa0, m5) |
| 11490 | mstore(0xc0, m6) |
| 11491 | mstore(0xe0, m7) |
| 11492 | mstore(0x100, m8) |
| 11493 | mstore(0x120, m9) |
| 11494 | mstore(0x140, m10) |
| 11495 | } |
| 11496 | } |
| 11497 | |
| 11498 | function log(bytes32 p0, bool p1, address p2, address p3) internal pure { |
| 11499 | bytes32 m0; |
| 11500 | bytes32 m1; |
| 11501 | bytes32 m2; |
| 11502 | bytes32 m3; |
| 11503 | bytes32 m4; |
| 11504 | bytes32 m5; |
| 11505 | bytes32 m6; |
| 11506 | /// @solidity memory-safe-assembly |
| 11507 | assembly { |
| 11508 | function writeString(pos, w) { |
| 11509 | let length := 0 |
| 11510 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 11511 | mstore(pos, length) |
| 11512 | let shift := sub(256, shl(3, length)) |
| 11513 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 11514 | } |
| 11515 | m0 := mload(0x00) |
| 11516 | m1 := mload(0x20) |
| 11517 | m2 := mload(0x40) |
| 11518 | m3 := mload(0x60) |
| 11519 | m4 := mload(0x80) |
| 11520 | m5 := mload(0xa0) |
| 11521 | m6 := mload(0xc0) |
| 11522 | // Selector of `log(string,bool,address,address)`. |
| 11523 | mstore(0x00, 0x33e9dd1d) |
| 11524 | mstore(0x20, 0x80) |
| 11525 | mstore(0x40, p1) |
| 11526 | mstore(0x60, p2) |
| 11527 | mstore(0x80, p3) |
| 11528 | writeString(0xa0, p0) |
| 11529 | } |
| 11530 | _sendLogPayload(0x1c, 0xc4); |
| 11531 | /// @solidity memory-safe-assembly |
| 11532 | assembly { |
| 11533 | mstore(0x00, m0) |
| 11534 | mstore(0x20, m1) |
| 11535 | mstore(0x40, m2) |
| 11536 | mstore(0x60, m3) |
| 11537 | mstore(0x80, m4) |
| 11538 | mstore(0xa0, m5) |
| 11539 | mstore(0xc0, m6) |
| 11540 | } |
| 11541 | } |
| 11542 | |
| 11543 | function log(bytes32 p0, bool p1, address p2, bool p3) internal pure { |
| 11544 | bytes32 m0; |
| 11545 | bytes32 m1; |
| 11546 | bytes32 m2; |
| 11547 | bytes32 m3; |
| 11548 | bytes32 m4; |
| 11549 | bytes32 m5; |
| 11550 | bytes32 m6; |
| 11551 | /// @solidity memory-safe-assembly |
| 11552 | assembly { |
| 11553 | function writeString(pos, w) { |
| 11554 | let length := 0 |
| 11555 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 11556 | mstore(pos, length) |
| 11557 | let shift := sub(256, shl(3, length)) |
| 11558 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 11559 | } |
| 11560 | m0 := mload(0x00) |
| 11561 | m1 := mload(0x20) |
| 11562 | m2 := mload(0x40) |
| 11563 | m3 := mload(0x60) |
| 11564 | m4 := mload(0x80) |
| 11565 | m5 := mload(0xa0) |
| 11566 | m6 := mload(0xc0) |
| 11567 | // Selector of `log(string,bool,address,bool)`. |
| 11568 | mstore(0x00, 0x958c28c6) |
| 11569 | mstore(0x20, 0x80) |
| 11570 | mstore(0x40, p1) |
| 11571 | mstore(0x60, p2) |
| 11572 | mstore(0x80, p3) |
| 11573 | writeString(0xa0, p0) |
| 11574 | } |
| 11575 | _sendLogPayload(0x1c, 0xc4); |
| 11576 | /// @solidity memory-safe-assembly |
| 11577 | assembly { |
| 11578 | mstore(0x00, m0) |
| 11579 | mstore(0x20, m1) |
| 11580 | mstore(0x40, m2) |
| 11581 | mstore(0x60, m3) |
| 11582 | mstore(0x80, m4) |
| 11583 | mstore(0xa0, m5) |
| 11584 | mstore(0xc0, m6) |
| 11585 | } |
| 11586 | } |
| 11587 | |
| 11588 | function log(bytes32 p0, bool p1, address p2, uint256 p3) internal pure { |
| 11589 | bytes32 m0; |
| 11590 | bytes32 m1; |
| 11591 | bytes32 m2; |
| 11592 | bytes32 m3; |
| 11593 | bytes32 m4; |
| 11594 | bytes32 m5; |
| 11595 | bytes32 m6; |
| 11596 | /// @solidity memory-safe-assembly |
| 11597 | assembly { |
| 11598 | function writeString(pos, w) { |
| 11599 | let length := 0 |
| 11600 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 11601 | mstore(pos, length) |
| 11602 | let shift := sub(256, shl(3, length)) |
| 11603 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 11604 | } |
| 11605 | m0 := mload(0x00) |
| 11606 | m1 := mload(0x20) |
| 11607 | m2 := mload(0x40) |
| 11608 | m3 := mload(0x60) |
| 11609 | m4 := mload(0x80) |
| 11610 | m5 := mload(0xa0) |
| 11611 | m6 := mload(0xc0) |
| 11612 | // Selector of `log(string,bool,address,uint256)`. |
| 11613 | mstore(0x00, 0x5d08bb05) |
| 11614 | mstore(0x20, 0x80) |
| 11615 | mstore(0x40, p1) |
| 11616 | mstore(0x60, p2) |
| 11617 | mstore(0x80, p3) |
| 11618 | writeString(0xa0, p0) |
| 11619 | } |
| 11620 | _sendLogPayload(0x1c, 0xc4); |
| 11621 | /// @solidity memory-safe-assembly |
| 11622 | assembly { |
| 11623 | mstore(0x00, m0) |
| 11624 | mstore(0x20, m1) |
| 11625 | mstore(0x40, m2) |
| 11626 | mstore(0x60, m3) |
| 11627 | mstore(0x80, m4) |
| 11628 | mstore(0xa0, m5) |
| 11629 | mstore(0xc0, m6) |
| 11630 | } |
| 11631 | } |
| 11632 | |
| 11633 | function log(bytes32 p0, bool p1, address p2, bytes32 p3) internal pure { |
| 11634 | bytes32 m0; |
| 11635 | bytes32 m1; |
| 11636 | bytes32 m2; |
| 11637 | bytes32 m3; |
| 11638 | bytes32 m4; |
| 11639 | bytes32 m5; |
| 11640 | bytes32 m6; |
| 11641 | bytes32 m7; |
| 11642 | bytes32 m8; |
| 11643 | /// @solidity memory-safe-assembly |
| 11644 | assembly { |
| 11645 | function writeString(pos, w) { |
| 11646 | let length := 0 |
| 11647 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 11648 | mstore(pos, length) |
| 11649 | let shift := sub(256, shl(3, length)) |
| 11650 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 11651 | } |
| 11652 | m0 := mload(0x00) |
| 11653 | m1 := mload(0x20) |
| 11654 | m2 := mload(0x40) |
| 11655 | m3 := mload(0x60) |
| 11656 | m4 := mload(0x80) |
| 11657 | m5 := mload(0xa0) |
| 11658 | m6 := mload(0xc0) |
| 11659 | m7 := mload(0xe0) |
| 11660 | m8 := mload(0x100) |
| 11661 | // Selector of `log(string,bool,address,string)`. |
| 11662 | mstore(0x00, 0x2d8e33a4) |
| 11663 | mstore(0x20, 0x80) |
| 11664 | mstore(0x40, p1) |
| 11665 | mstore(0x60, p2) |
| 11666 | mstore(0x80, 0xc0) |
| 11667 | writeString(0xa0, p0) |
| 11668 | writeString(0xe0, p3) |
| 11669 | } |
| 11670 | _sendLogPayload(0x1c, 0x104); |
| 11671 | /// @solidity memory-safe-assembly |
| 11672 | assembly { |
| 11673 | mstore(0x00, m0) |
| 11674 | mstore(0x20, m1) |
| 11675 | mstore(0x40, m2) |
| 11676 | mstore(0x60, m3) |
| 11677 | mstore(0x80, m4) |
| 11678 | mstore(0xa0, m5) |
| 11679 | mstore(0xc0, m6) |
| 11680 | mstore(0xe0, m7) |
| 11681 | mstore(0x100, m8) |
| 11682 | } |
| 11683 | } |
| 11684 | |
| 11685 | function log(bytes32 p0, bool p1, bool p2, address p3) internal pure { |
| 11686 | bytes32 m0; |
| 11687 | bytes32 m1; |
| 11688 | bytes32 m2; |
| 11689 | bytes32 m3; |
| 11690 | bytes32 m4; |
| 11691 | bytes32 m5; |
| 11692 | bytes32 m6; |
| 11693 | /// @solidity memory-safe-assembly |
| 11694 | assembly { |
| 11695 | function writeString(pos, w) { |
| 11696 | let length := 0 |
| 11697 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 11698 | mstore(pos, length) |
| 11699 | let shift := sub(256, shl(3, length)) |
| 11700 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 11701 | } |
| 11702 | m0 := mload(0x00) |
| 11703 | m1 := mload(0x20) |
| 11704 | m2 := mload(0x40) |
| 11705 | m3 := mload(0x60) |
| 11706 | m4 := mload(0x80) |
| 11707 | m5 := mload(0xa0) |
| 11708 | m6 := mload(0xc0) |
| 11709 | // Selector of `log(string,bool,bool,address)`. |
| 11710 | mstore(0x00, 0x7190a529) |
| 11711 | mstore(0x20, 0x80) |
| 11712 | mstore(0x40, p1) |
| 11713 | mstore(0x60, p2) |
| 11714 | mstore(0x80, p3) |
| 11715 | writeString(0xa0, p0) |
| 11716 | } |
| 11717 | _sendLogPayload(0x1c, 0xc4); |
| 11718 | /// @solidity memory-safe-assembly |
| 11719 | assembly { |
| 11720 | mstore(0x00, m0) |
| 11721 | mstore(0x20, m1) |
| 11722 | mstore(0x40, m2) |
| 11723 | mstore(0x60, m3) |
| 11724 | mstore(0x80, m4) |
| 11725 | mstore(0xa0, m5) |
| 11726 | mstore(0xc0, m6) |
| 11727 | } |
| 11728 | } |
| 11729 | |
| 11730 | function log(bytes32 p0, bool p1, bool p2, bool p3) internal pure { |
| 11731 | bytes32 m0; |
| 11732 | bytes32 m1; |
| 11733 | bytes32 m2; |
| 11734 | bytes32 m3; |
| 11735 | bytes32 m4; |
| 11736 | bytes32 m5; |
| 11737 | bytes32 m6; |
| 11738 | /// @solidity memory-safe-assembly |
| 11739 | assembly { |
| 11740 | function writeString(pos, w) { |
| 11741 | let length := 0 |
| 11742 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 11743 | mstore(pos, length) |
| 11744 | let shift := sub(256, shl(3, length)) |
| 11745 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 11746 | } |
| 11747 | m0 := mload(0x00) |
| 11748 | m1 := mload(0x20) |
| 11749 | m2 := mload(0x40) |
| 11750 | m3 := mload(0x60) |
| 11751 | m4 := mload(0x80) |
| 11752 | m5 := mload(0xa0) |
| 11753 | m6 := mload(0xc0) |
| 11754 | // Selector of `log(string,bool,bool,bool)`. |
| 11755 | mstore(0x00, 0x895af8c5) |
| 11756 | mstore(0x20, 0x80) |
| 11757 | mstore(0x40, p1) |
| 11758 | mstore(0x60, p2) |
| 11759 | mstore(0x80, p3) |
| 11760 | writeString(0xa0, p0) |
| 11761 | } |
| 11762 | _sendLogPayload(0x1c, 0xc4); |
| 11763 | /// @solidity memory-safe-assembly |
| 11764 | assembly { |
| 11765 | mstore(0x00, m0) |
| 11766 | mstore(0x20, m1) |
| 11767 | mstore(0x40, m2) |
| 11768 | mstore(0x60, m3) |
| 11769 | mstore(0x80, m4) |
| 11770 | mstore(0xa0, m5) |
| 11771 | mstore(0xc0, m6) |
| 11772 | } |
| 11773 | } |
| 11774 | |
| 11775 | function log(bytes32 p0, bool p1, bool p2, uint256 p3) internal pure { |
| 11776 | bytes32 m0; |
| 11777 | bytes32 m1; |
| 11778 | bytes32 m2; |
| 11779 | bytes32 m3; |
| 11780 | bytes32 m4; |
| 11781 | bytes32 m5; |
| 11782 | bytes32 m6; |
| 11783 | /// @solidity memory-safe-assembly |
| 11784 | assembly { |
| 11785 | function writeString(pos, w) { |
| 11786 | let length := 0 |
| 11787 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 11788 | mstore(pos, length) |
| 11789 | let shift := sub(256, shl(3, length)) |
| 11790 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 11791 | } |
| 11792 | m0 := mload(0x00) |
| 11793 | m1 := mload(0x20) |
| 11794 | m2 := mload(0x40) |
| 11795 | m3 := mload(0x60) |
| 11796 | m4 := mload(0x80) |
| 11797 | m5 := mload(0xa0) |
| 11798 | m6 := mload(0xc0) |
| 11799 | // Selector of `log(string,bool,bool,uint256)`. |
| 11800 | mstore(0x00, 0x8e3f78a9) |
| 11801 | mstore(0x20, 0x80) |
| 11802 | mstore(0x40, p1) |
| 11803 | mstore(0x60, p2) |
| 11804 | mstore(0x80, p3) |
| 11805 | writeString(0xa0, p0) |
| 11806 | } |
| 11807 | _sendLogPayload(0x1c, 0xc4); |
| 11808 | /// @solidity memory-safe-assembly |
| 11809 | assembly { |
| 11810 | mstore(0x00, m0) |
| 11811 | mstore(0x20, m1) |
| 11812 | mstore(0x40, m2) |
| 11813 | mstore(0x60, m3) |
| 11814 | mstore(0x80, m4) |
| 11815 | mstore(0xa0, m5) |
| 11816 | mstore(0xc0, m6) |
| 11817 | } |
| 11818 | } |
| 11819 | |
| 11820 | function log(bytes32 p0, bool p1, bool p2, bytes32 p3) internal pure { |
| 11821 | bytes32 m0; |
| 11822 | bytes32 m1; |
| 11823 | bytes32 m2; |
| 11824 | bytes32 m3; |
| 11825 | bytes32 m4; |
| 11826 | bytes32 m5; |
| 11827 | bytes32 m6; |
| 11828 | bytes32 m7; |
| 11829 | bytes32 m8; |
| 11830 | /// @solidity memory-safe-assembly |
| 11831 | assembly { |
| 11832 | function writeString(pos, w) { |
| 11833 | let length := 0 |
| 11834 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 11835 | mstore(pos, length) |
| 11836 | let shift := sub(256, shl(3, length)) |
| 11837 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 11838 | } |
| 11839 | m0 := mload(0x00) |
| 11840 | m1 := mload(0x20) |
| 11841 | m2 := mload(0x40) |
| 11842 | m3 := mload(0x60) |
| 11843 | m4 := mload(0x80) |
| 11844 | m5 := mload(0xa0) |
| 11845 | m6 := mload(0xc0) |
| 11846 | m7 := mload(0xe0) |
| 11847 | m8 := mload(0x100) |
| 11848 | // Selector of `log(string,bool,bool,string)`. |
| 11849 | mstore(0x00, 0x9d22d5dd) |
| 11850 | mstore(0x20, 0x80) |
| 11851 | mstore(0x40, p1) |
| 11852 | mstore(0x60, p2) |
| 11853 | mstore(0x80, 0xc0) |
| 11854 | writeString(0xa0, p0) |
| 11855 | writeString(0xe0, p3) |
| 11856 | } |
| 11857 | _sendLogPayload(0x1c, 0x104); |
| 11858 | /// @solidity memory-safe-assembly |
| 11859 | assembly { |
| 11860 | mstore(0x00, m0) |
| 11861 | mstore(0x20, m1) |
| 11862 | mstore(0x40, m2) |
| 11863 | mstore(0x60, m3) |
| 11864 | mstore(0x80, m4) |
| 11865 | mstore(0xa0, m5) |
| 11866 | mstore(0xc0, m6) |
| 11867 | mstore(0xe0, m7) |
| 11868 | mstore(0x100, m8) |
| 11869 | } |
| 11870 | } |
| 11871 | |
| 11872 | function log(bytes32 p0, bool p1, uint256 p2, address p3) internal pure { |
| 11873 | bytes32 m0; |
| 11874 | bytes32 m1; |
| 11875 | bytes32 m2; |
| 11876 | bytes32 m3; |
| 11877 | bytes32 m4; |
| 11878 | bytes32 m5; |
| 11879 | bytes32 m6; |
| 11880 | /// @solidity memory-safe-assembly |
| 11881 | assembly { |
| 11882 | function writeString(pos, w) { |
| 11883 | let length := 0 |
| 11884 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 11885 | mstore(pos, length) |
| 11886 | let shift := sub(256, shl(3, length)) |
| 11887 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 11888 | } |
| 11889 | m0 := mload(0x00) |
| 11890 | m1 := mload(0x20) |
| 11891 | m2 := mload(0x40) |
| 11892 | m3 := mload(0x60) |
| 11893 | m4 := mload(0x80) |
| 11894 | m5 := mload(0xa0) |
| 11895 | m6 := mload(0xc0) |
| 11896 | // Selector of `log(string,bool,uint256,address)`. |
| 11897 | mstore(0x00, 0x935e09bf) |
| 11898 | mstore(0x20, 0x80) |
| 11899 | mstore(0x40, p1) |
| 11900 | mstore(0x60, p2) |
| 11901 | mstore(0x80, p3) |
| 11902 | writeString(0xa0, p0) |
| 11903 | } |
| 11904 | _sendLogPayload(0x1c, 0xc4); |
| 11905 | /// @solidity memory-safe-assembly |
| 11906 | assembly { |
| 11907 | mstore(0x00, m0) |
| 11908 | mstore(0x20, m1) |
| 11909 | mstore(0x40, m2) |
| 11910 | mstore(0x60, m3) |
| 11911 | mstore(0x80, m4) |
| 11912 | mstore(0xa0, m5) |
| 11913 | mstore(0xc0, m6) |
| 11914 | } |
| 11915 | } |
| 11916 | |
| 11917 | function log(bytes32 p0, bool p1, uint256 p2, bool p3) internal pure { |
| 11918 | bytes32 m0; |
| 11919 | bytes32 m1; |
| 11920 | bytes32 m2; |
| 11921 | bytes32 m3; |
| 11922 | bytes32 m4; |
| 11923 | bytes32 m5; |
| 11924 | bytes32 m6; |
| 11925 | /// @solidity memory-safe-assembly |
| 11926 | assembly { |
| 11927 | function writeString(pos, w) { |
| 11928 | let length := 0 |
| 11929 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 11930 | mstore(pos, length) |
| 11931 | let shift := sub(256, shl(3, length)) |
| 11932 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 11933 | } |
| 11934 | m0 := mload(0x00) |
| 11935 | m1 := mload(0x20) |
| 11936 | m2 := mload(0x40) |
| 11937 | m3 := mload(0x60) |
| 11938 | m4 := mload(0x80) |
| 11939 | m5 := mload(0xa0) |
| 11940 | m6 := mload(0xc0) |
| 11941 | // Selector of `log(string,bool,uint256,bool)`. |
| 11942 | mstore(0x00, 0x8af7cf8a) |
| 11943 | mstore(0x20, 0x80) |
| 11944 | mstore(0x40, p1) |
| 11945 | mstore(0x60, p2) |
| 11946 | mstore(0x80, p3) |
| 11947 | writeString(0xa0, p0) |
| 11948 | } |
| 11949 | _sendLogPayload(0x1c, 0xc4); |
| 11950 | /// @solidity memory-safe-assembly |
| 11951 | assembly { |
| 11952 | mstore(0x00, m0) |
| 11953 | mstore(0x20, m1) |
| 11954 | mstore(0x40, m2) |
| 11955 | mstore(0x60, m3) |
| 11956 | mstore(0x80, m4) |
| 11957 | mstore(0xa0, m5) |
| 11958 | mstore(0xc0, m6) |
| 11959 | } |
| 11960 | } |
| 11961 | |
| 11962 | function log(bytes32 p0, bool p1, uint256 p2, uint256 p3) internal pure { |
| 11963 | bytes32 m0; |
| 11964 | bytes32 m1; |
| 11965 | bytes32 m2; |
| 11966 | bytes32 m3; |
| 11967 | bytes32 m4; |
| 11968 | bytes32 m5; |
| 11969 | bytes32 m6; |
| 11970 | /// @solidity memory-safe-assembly |
| 11971 | assembly { |
| 11972 | function writeString(pos, w) { |
| 11973 | let length := 0 |
| 11974 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 11975 | mstore(pos, length) |
| 11976 | let shift := sub(256, shl(3, length)) |
| 11977 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 11978 | } |
| 11979 | m0 := mload(0x00) |
| 11980 | m1 := mload(0x20) |
| 11981 | m2 := mload(0x40) |
| 11982 | m3 := mload(0x60) |
| 11983 | m4 := mload(0x80) |
| 11984 | m5 := mload(0xa0) |
| 11985 | m6 := mload(0xc0) |
| 11986 | // Selector of `log(string,bool,uint256,uint256)`. |
| 11987 | mstore(0x00, 0x64b5bb67) |
| 11988 | mstore(0x20, 0x80) |
| 11989 | mstore(0x40, p1) |
| 11990 | mstore(0x60, p2) |
| 11991 | mstore(0x80, p3) |
| 11992 | writeString(0xa0, p0) |
| 11993 | } |
| 11994 | _sendLogPayload(0x1c, 0xc4); |
| 11995 | /// @solidity memory-safe-assembly |
| 11996 | assembly { |
| 11997 | mstore(0x00, m0) |
| 11998 | mstore(0x20, m1) |
| 11999 | mstore(0x40, m2) |
| 12000 | mstore(0x60, m3) |
| 12001 | mstore(0x80, m4) |
| 12002 | mstore(0xa0, m5) |
| 12003 | mstore(0xc0, m6) |
| 12004 | } |
| 12005 | } |
| 12006 | |
| 12007 | function log(bytes32 p0, bool p1, uint256 p2, bytes32 p3) internal pure { |
| 12008 | bytes32 m0; |
| 12009 | bytes32 m1; |
| 12010 | bytes32 m2; |
| 12011 | bytes32 m3; |
| 12012 | bytes32 m4; |
| 12013 | bytes32 m5; |
| 12014 | bytes32 m6; |
| 12015 | bytes32 m7; |
| 12016 | bytes32 m8; |
| 12017 | /// @solidity memory-safe-assembly |
| 12018 | assembly { |
| 12019 | function writeString(pos, w) { |
| 12020 | let length := 0 |
| 12021 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 12022 | mstore(pos, length) |
| 12023 | let shift := sub(256, shl(3, length)) |
| 12024 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 12025 | } |
| 12026 | m0 := mload(0x00) |
| 12027 | m1 := mload(0x20) |
| 12028 | m2 := mload(0x40) |
| 12029 | m3 := mload(0x60) |
| 12030 | m4 := mload(0x80) |
| 12031 | m5 := mload(0xa0) |
| 12032 | m6 := mload(0xc0) |
| 12033 | m7 := mload(0xe0) |
| 12034 | m8 := mload(0x100) |
| 12035 | // Selector of `log(string,bool,uint256,string)`. |
| 12036 | mstore(0x00, 0x742d6ee7) |
| 12037 | mstore(0x20, 0x80) |
| 12038 | mstore(0x40, p1) |
| 12039 | mstore(0x60, p2) |
| 12040 | mstore(0x80, 0xc0) |
| 12041 | writeString(0xa0, p0) |
| 12042 | writeString(0xe0, p3) |
| 12043 | } |
| 12044 | _sendLogPayload(0x1c, 0x104); |
| 12045 | /// @solidity memory-safe-assembly |
| 12046 | assembly { |
| 12047 | mstore(0x00, m0) |
| 12048 | mstore(0x20, m1) |
| 12049 | mstore(0x40, m2) |
| 12050 | mstore(0x60, m3) |
| 12051 | mstore(0x80, m4) |
| 12052 | mstore(0xa0, m5) |
| 12053 | mstore(0xc0, m6) |
| 12054 | mstore(0xe0, m7) |
| 12055 | mstore(0x100, m8) |
| 12056 | } |
| 12057 | } |
| 12058 | |
| 12059 | function log(bytes32 p0, bool p1, bytes32 p2, address p3) internal pure { |
| 12060 | bytes32 m0; |
| 12061 | bytes32 m1; |
| 12062 | bytes32 m2; |
| 12063 | bytes32 m3; |
| 12064 | bytes32 m4; |
| 12065 | bytes32 m5; |
| 12066 | bytes32 m6; |
| 12067 | bytes32 m7; |
| 12068 | bytes32 m8; |
| 12069 | /// @solidity memory-safe-assembly |
| 12070 | assembly { |
| 12071 | function writeString(pos, w) { |
| 12072 | let length := 0 |
| 12073 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 12074 | mstore(pos, length) |
| 12075 | let shift := sub(256, shl(3, length)) |
| 12076 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 12077 | } |
| 12078 | m0 := mload(0x00) |
| 12079 | m1 := mload(0x20) |
| 12080 | m2 := mload(0x40) |
| 12081 | m3 := mload(0x60) |
| 12082 | m4 := mload(0x80) |
| 12083 | m5 := mload(0xa0) |
| 12084 | m6 := mload(0xc0) |
| 12085 | m7 := mload(0xe0) |
| 12086 | m8 := mload(0x100) |
| 12087 | // Selector of `log(string,bool,string,address)`. |
| 12088 | mstore(0x00, 0xe0625b29) |
| 12089 | mstore(0x20, 0x80) |
| 12090 | mstore(0x40, p1) |
| 12091 | mstore(0x60, 0xc0) |
| 12092 | mstore(0x80, p3) |
| 12093 | writeString(0xa0, p0) |
| 12094 | writeString(0xe0, p2) |
| 12095 | } |
| 12096 | _sendLogPayload(0x1c, 0x104); |
| 12097 | /// @solidity memory-safe-assembly |
| 12098 | assembly { |
| 12099 | mstore(0x00, m0) |
| 12100 | mstore(0x20, m1) |
| 12101 | mstore(0x40, m2) |
| 12102 | mstore(0x60, m3) |
| 12103 | mstore(0x80, m4) |
| 12104 | mstore(0xa0, m5) |
| 12105 | mstore(0xc0, m6) |
| 12106 | mstore(0xe0, m7) |
| 12107 | mstore(0x100, m8) |
| 12108 | } |
| 12109 | } |
| 12110 | |
| 12111 | function log(bytes32 p0, bool p1, bytes32 p2, bool p3) internal pure { |
| 12112 | bytes32 m0; |
| 12113 | bytes32 m1; |
| 12114 | bytes32 m2; |
| 12115 | bytes32 m3; |
| 12116 | bytes32 m4; |
| 12117 | bytes32 m5; |
| 12118 | bytes32 m6; |
| 12119 | bytes32 m7; |
| 12120 | bytes32 m8; |
| 12121 | /// @solidity memory-safe-assembly |
| 12122 | assembly { |
| 12123 | function writeString(pos, w) { |
| 12124 | let length := 0 |
| 12125 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 12126 | mstore(pos, length) |
| 12127 | let shift := sub(256, shl(3, length)) |
| 12128 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 12129 | } |
| 12130 | m0 := mload(0x00) |
| 12131 | m1 := mload(0x20) |
| 12132 | m2 := mload(0x40) |
| 12133 | m3 := mload(0x60) |
| 12134 | m4 := mload(0x80) |
| 12135 | m5 := mload(0xa0) |
| 12136 | m6 := mload(0xc0) |
| 12137 | m7 := mload(0xe0) |
| 12138 | m8 := mload(0x100) |
| 12139 | // Selector of `log(string,bool,string,bool)`. |
| 12140 | mstore(0x00, 0x3f8a701d) |
| 12141 | mstore(0x20, 0x80) |
| 12142 | mstore(0x40, p1) |
| 12143 | mstore(0x60, 0xc0) |
| 12144 | mstore(0x80, p3) |
| 12145 | writeString(0xa0, p0) |
| 12146 | writeString(0xe0, p2) |
| 12147 | } |
| 12148 | _sendLogPayload(0x1c, 0x104); |
| 12149 | /// @solidity memory-safe-assembly |
| 12150 | assembly { |
| 12151 | mstore(0x00, m0) |
| 12152 | mstore(0x20, m1) |
| 12153 | mstore(0x40, m2) |
| 12154 | mstore(0x60, m3) |
| 12155 | mstore(0x80, m4) |
| 12156 | mstore(0xa0, m5) |
| 12157 | mstore(0xc0, m6) |
| 12158 | mstore(0xe0, m7) |
| 12159 | mstore(0x100, m8) |
| 12160 | } |
| 12161 | } |
| 12162 | |
| 12163 | function log(bytes32 p0, bool p1, bytes32 p2, uint256 p3) internal pure { |
| 12164 | bytes32 m0; |
| 12165 | bytes32 m1; |
| 12166 | bytes32 m2; |
| 12167 | bytes32 m3; |
| 12168 | bytes32 m4; |
| 12169 | bytes32 m5; |
| 12170 | bytes32 m6; |
| 12171 | bytes32 m7; |
| 12172 | bytes32 m8; |
| 12173 | /// @solidity memory-safe-assembly |
| 12174 | assembly { |
| 12175 | function writeString(pos, w) { |
| 12176 | let length := 0 |
| 12177 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 12178 | mstore(pos, length) |
| 12179 | let shift := sub(256, shl(3, length)) |
| 12180 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 12181 | } |
| 12182 | m0 := mload(0x00) |
| 12183 | m1 := mload(0x20) |
| 12184 | m2 := mload(0x40) |
| 12185 | m3 := mload(0x60) |
| 12186 | m4 := mload(0x80) |
| 12187 | m5 := mload(0xa0) |
| 12188 | m6 := mload(0xc0) |
| 12189 | m7 := mload(0xe0) |
| 12190 | m8 := mload(0x100) |
| 12191 | // Selector of `log(string,bool,string,uint256)`. |
| 12192 | mstore(0x00, 0x24f91465) |
| 12193 | mstore(0x20, 0x80) |
| 12194 | mstore(0x40, p1) |
| 12195 | mstore(0x60, 0xc0) |
| 12196 | mstore(0x80, p3) |
| 12197 | writeString(0xa0, p0) |
| 12198 | writeString(0xe0, p2) |
| 12199 | } |
| 12200 | _sendLogPayload(0x1c, 0x104); |
| 12201 | /// @solidity memory-safe-assembly |
| 12202 | assembly { |
| 12203 | mstore(0x00, m0) |
| 12204 | mstore(0x20, m1) |
| 12205 | mstore(0x40, m2) |
| 12206 | mstore(0x60, m3) |
| 12207 | mstore(0x80, m4) |
| 12208 | mstore(0xa0, m5) |
| 12209 | mstore(0xc0, m6) |
| 12210 | mstore(0xe0, m7) |
| 12211 | mstore(0x100, m8) |
| 12212 | } |
| 12213 | } |
| 12214 | |
| 12215 | function log(bytes32 p0, bool p1, bytes32 p2, bytes32 p3) internal pure { |
| 12216 | bytes32 m0; |
| 12217 | bytes32 m1; |
| 12218 | bytes32 m2; |
| 12219 | bytes32 m3; |
| 12220 | bytes32 m4; |
| 12221 | bytes32 m5; |
| 12222 | bytes32 m6; |
| 12223 | bytes32 m7; |
| 12224 | bytes32 m8; |
| 12225 | bytes32 m9; |
| 12226 | bytes32 m10; |
| 12227 | /// @solidity memory-safe-assembly |
| 12228 | assembly { |
| 12229 | function writeString(pos, w) { |
| 12230 | let length := 0 |
| 12231 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 12232 | mstore(pos, length) |
| 12233 | let shift := sub(256, shl(3, length)) |
| 12234 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 12235 | } |
| 12236 | m0 := mload(0x00) |
| 12237 | m1 := mload(0x20) |
| 12238 | m2 := mload(0x40) |
| 12239 | m3 := mload(0x60) |
| 12240 | m4 := mload(0x80) |
| 12241 | m5 := mload(0xa0) |
| 12242 | m6 := mload(0xc0) |
| 12243 | m7 := mload(0xe0) |
| 12244 | m8 := mload(0x100) |
| 12245 | m9 := mload(0x120) |
| 12246 | m10 := mload(0x140) |
| 12247 | // Selector of `log(string,bool,string,string)`. |
| 12248 | mstore(0x00, 0xa826caeb) |
| 12249 | mstore(0x20, 0x80) |
| 12250 | mstore(0x40, p1) |
| 12251 | mstore(0x60, 0xc0) |
| 12252 | mstore(0x80, 0x100) |
| 12253 | writeString(0xa0, p0) |
| 12254 | writeString(0xe0, p2) |
| 12255 | writeString(0x120, p3) |
| 12256 | } |
| 12257 | _sendLogPayload(0x1c, 0x144); |
| 12258 | /// @solidity memory-safe-assembly |
| 12259 | assembly { |
| 12260 | mstore(0x00, m0) |
| 12261 | mstore(0x20, m1) |
| 12262 | mstore(0x40, m2) |
| 12263 | mstore(0x60, m3) |
| 12264 | mstore(0x80, m4) |
| 12265 | mstore(0xa0, m5) |
| 12266 | mstore(0xc0, m6) |
| 12267 | mstore(0xe0, m7) |
| 12268 | mstore(0x100, m8) |
| 12269 | mstore(0x120, m9) |
| 12270 | mstore(0x140, m10) |
| 12271 | } |
| 12272 | } |
| 12273 | |
| 12274 | function log(bytes32 p0, uint256 p1, address p2, address p3) internal pure { |
| 12275 | bytes32 m0; |
| 12276 | bytes32 m1; |
| 12277 | bytes32 m2; |
| 12278 | bytes32 m3; |
| 12279 | bytes32 m4; |
| 12280 | bytes32 m5; |
| 12281 | bytes32 m6; |
| 12282 | /// @solidity memory-safe-assembly |
| 12283 | assembly { |
| 12284 | function writeString(pos, w) { |
| 12285 | let length := 0 |
| 12286 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 12287 | mstore(pos, length) |
| 12288 | let shift := sub(256, shl(3, length)) |
| 12289 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 12290 | } |
| 12291 | m0 := mload(0x00) |
| 12292 | m1 := mload(0x20) |
| 12293 | m2 := mload(0x40) |
| 12294 | m3 := mload(0x60) |
| 12295 | m4 := mload(0x80) |
| 12296 | m5 := mload(0xa0) |
| 12297 | m6 := mload(0xc0) |
| 12298 | // Selector of `log(string,uint256,address,address)`. |
| 12299 | mstore(0x00, 0x5ea2b7ae) |
| 12300 | mstore(0x20, 0x80) |
| 12301 | mstore(0x40, p1) |
| 12302 | mstore(0x60, p2) |
| 12303 | mstore(0x80, p3) |
| 12304 | writeString(0xa0, p0) |
| 12305 | } |
| 12306 | _sendLogPayload(0x1c, 0xc4); |
| 12307 | /// @solidity memory-safe-assembly |
| 12308 | assembly { |
| 12309 | mstore(0x00, m0) |
| 12310 | mstore(0x20, m1) |
| 12311 | mstore(0x40, m2) |
| 12312 | mstore(0x60, m3) |
| 12313 | mstore(0x80, m4) |
| 12314 | mstore(0xa0, m5) |
| 12315 | mstore(0xc0, m6) |
| 12316 | } |
| 12317 | } |
| 12318 | |
| 12319 | function log(bytes32 p0, uint256 p1, address p2, bool p3) internal pure { |
| 12320 | bytes32 m0; |
| 12321 | bytes32 m1; |
| 12322 | bytes32 m2; |
| 12323 | bytes32 m3; |
| 12324 | bytes32 m4; |
| 12325 | bytes32 m5; |
| 12326 | bytes32 m6; |
| 12327 | /// @solidity memory-safe-assembly |
| 12328 | assembly { |
| 12329 | function writeString(pos, w) { |
| 12330 | let length := 0 |
| 12331 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 12332 | mstore(pos, length) |
| 12333 | let shift := sub(256, shl(3, length)) |
| 12334 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 12335 | } |
| 12336 | m0 := mload(0x00) |
| 12337 | m1 := mload(0x20) |
| 12338 | m2 := mload(0x40) |
| 12339 | m3 := mload(0x60) |
| 12340 | m4 := mload(0x80) |
| 12341 | m5 := mload(0xa0) |
| 12342 | m6 := mload(0xc0) |
| 12343 | // Selector of `log(string,uint256,address,bool)`. |
| 12344 | mstore(0x00, 0x82112a42) |
| 12345 | mstore(0x20, 0x80) |
| 12346 | mstore(0x40, p1) |
| 12347 | mstore(0x60, p2) |
| 12348 | mstore(0x80, p3) |
| 12349 | writeString(0xa0, p0) |
| 12350 | } |
| 12351 | _sendLogPayload(0x1c, 0xc4); |
| 12352 | /// @solidity memory-safe-assembly |
| 12353 | assembly { |
| 12354 | mstore(0x00, m0) |
| 12355 | mstore(0x20, m1) |
| 12356 | mstore(0x40, m2) |
| 12357 | mstore(0x60, m3) |
| 12358 | mstore(0x80, m4) |
| 12359 | mstore(0xa0, m5) |
| 12360 | mstore(0xc0, m6) |
| 12361 | } |
| 12362 | } |
| 12363 | |
| 12364 | function log(bytes32 p0, uint256 p1, address p2, uint256 p3) internal pure { |
| 12365 | bytes32 m0; |
| 12366 | bytes32 m1; |
| 12367 | bytes32 m2; |
| 12368 | bytes32 m3; |
| 12369 | bytes32 m4; |
| 12370 | bytes32 m5; |
| 12371 | bytes32 m6; |
| 12372 | /// @solidity memory-safe-assembly |
| 12373 | assembly { |
| 12374 | function writeString(pos, w) { |
| 12375 | let length := 0 |
| 12376 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 12377 | mstore(pos, length) |
| 12378 | let shift := sub(256, shl(3, length)) |
| 12379 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 12380 | } |
| 12381 | m0 := mload(0x00) |
| 12382 | m1 := mload(0x20) |
| 12383 | m2 := mload(0x40) |
| 12384 | m3 := mload(0x60) |
| 12385 | m4 := mload(0x80) |
| 12386 | m5 := mload(0xa0) |
| 12387 | m6 := mload(0xc0) |
| 12388 | // Selector of `log(string,uint256,address,uint256)`. |
| 12389 | mstore(0x00, 0x4f04fdc6) |
| 12390 | mstore(0x20, 0x80) |
| 12391 | mstore(0x40, p1) |
| 12392 | mstore(0x60, p2) |
| 12393 | mstore(0x80, p3) |
| 12394 | writeString(0xa0, p0) |
| 12395 | } |
| 12396 | _sendLogPayload(0x1c, 0xc4); |
| 12397 | /// @solidity memory-safe-assembly |
| 12398 | assembly { |
| 12399 | mstore(0x00, m0) |
| 12400 | mstore(0x20, m1) |
| 12401 | mstore(0x40, m2) |
| 12402 | mstore(0x60, m3) |
| 12403 | mstore(0x80, m4) |
| 12404 | mstore(0xa0, m5) |
| 12405 | mstore(0xc0, m6) |
| 12406 | } |
| 12407 | } |
| 12408 | |
| 12409 | function log(bytes32 p0, uint256 p1, address p2, bytes32 p3) internal pure { |
| 12410 | bytes32 m0; |
| 12411 | bytes32 m1; |
| 12412 | bytes32 m2; |
| 12413 | bytes32 m3; |
| 12414 | bytes32 m4; |
| 12415 | bytes32 m5; |
| 12416 | bytes32 m6; |
| 12417 | bytes32 m7; |
| 12418 | bytes32 m8; |
| 12419 | /// @solidity memory-safe-assembly |
| 12420 | assembly { |
| 12421 | function writeString(pos, w) { |
| 12422 | let length := 0 |
| 12423 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 12424 | mstore(pos, length) |
| 12425 | let shift := sub(256, shl(3, length)) |
| 12426 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 12427 | } |
| 12428 | m0 := mload(0x00) |
| 12429 | m1 := mload(0x20) |
| 12430 | m2 := mload(0x40) |
| 12431 | m3 := mload(0x60) |
| 12432 | m4 := mload(0x80) |
| 12433 | m5 := mload(0xa0) |
| 12434 | m6 := mload(0xc0) |
| 12435 | m7 := mload(0xe0) |
| 12436 | m8 := mload(0x100) |
| 12437 | // Selector of `log(string,uint256,address,string)`. |
| 12438 | mstore(0x00, 0x9ffb2f93) |
| 12439 | mstore(0x20, 0x80) |
| 12440 | mstore(0x40, p1) |
| 12441 | mstore(0x60, p2) |
| 12442 | mstore(0x80, 0xc0) |
| 12443 | writeString(0xa0, p0) |
| 12444 | writeString(0xe0, p3) |
| 12445 | } |
| 12446 | _sendLogPayload(0x1c, 0x104); |
| 12447 | /// @solidity memory-safe-assembly |
| 12448 | assembly { |
| 12449 | mstore(0x00, m0) |
| 12450 | mstore(0x20, m1) |
| 12451 | mstore(0x40, m2) |
| 12452 | mstore(0x60, m3) |
| 12453 | mstore(0x80, m4) |
| 12454 | mstore(0xa0, m5) |
| 12455 | mstore(0xc0, m6) |
| 12456 | mstore(0xe0, m7) |
| 12457 | mstore(0x100, m8) |
| 12458 | } |
| 12459 | } |
| 12460 | |
| 12461 | function log(bytes32 p0, uint256 p1, bool p2, address p3) internal pure { |
| 12462 | bytes32 m0; |
| 12463 | bytes32 m1; |
| 12464 | bytes32 m2; |
| 12465 | bytes32 m3; |
| 12466 | bytes32 m4; |
| 12467 | bytes32 m5; |
| 12468 | bytes32 m6; |
| 12469 | /// @solidity memory-safe-assembly |
| 12470 | assembly { |
| 12471 | function writeString(pos, w) { |
| 12472 | let length := 0 |
| 12473 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 12474 | mstore(pos, length) |
| 12475 | let shift := sub(256, shl(3, length)) |
| 12476 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 12477 | } |
| 12478 | m0 := mload(0x00) |
| 12479 | m1 := mload(0x20) |
| 12480 | m2 := mload(0x40) |
| 12481 | m3 := mload(0x60) |
| 12482 | m4 := mload(0x80) |
| 12483 | m5 := mload(0xa0) |
| 12484 | m6 := mload(0xc0) |
| 12485 | // Selector of `log(string,uint256,bool,address)`. |
| 12486 | mstore(0x00, 0xe0e95b98) |
| 12487 | mstore(0x20, 0x80) |
| 12488 | mstore(0x40, p1) |
| 12489 | mstore(0x60, p2) |
| 12490 | mstore(0x80, p3) |
| 12491 | writeString(0xa0, p0) |
| 12492 | } |
| 12493 | _sendLogPayload(0x1c, 0xc4); |
| 12494 | /// @solidity memory-safe-assembly |
| 12495 | assembly { |
| 12496 | mstore(0x00, m0) |
| 12497 | mstore(0x20, m1) |
| 12498 | mstore(0x40, m2) |
| 12499 | mstore(0x60, m3) |
| 12500 | mstore(0x80, m4) |
| 12501 | mstore(0xa0, m5) |
| 12502 | mstore(0xc0, m6) |
| 12503 | } |
| 12504 | } |
| 12505 | |
| 12506 | function log(bytes32 p0, uint256 p1, bool p2, bool p3) internal pure { |
| 12507 | bytes32 m0; |
| 12508 | bytes32 m1; |
| 12509 | bytes32 m2; |
| 12510 | bytes32 m3; |
| 12511 | bytes32 m4; |
| 12512 | bytes32 m5; |
| 12513 | bytes32 m6; |
| 12514 | /// @solidity memory-safe-assembly |
| 12515 | assembly { |
| 12516 | function writeString(pos, w) { |
| 12517 | let length := 0 |
| 12518 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 12519 | mstore(pos, length) |
| 12520 | let shift := sub(256, shl(3, length)) |
| 12521 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 12522 | } |
| 12523 | m0 := mload(0x00) |
| 12524 | m1 := mload(0x20) |
| 12525 | m2 := mload(0x40) |
| 12526 | m3 := mload(0x60) |
| 12527 | m4 := mload(0x80) |
| 12528 | m5 := mload(0xa0) |
| 12529 | m6 := mload(0xc0) |
| 12530 | // Selector of `log(string,uint256,bool,bool)`. |
| 12531 | mstore(0x00, 0x354c36d6) |
| 12532 | mstore(0x20, 0x80) |
| 12533 | mstore(0x40, p1) |
| 12534 | mstore(0x60, p2) |
| 12535 | mstore(0x80, p3) |
| 12536 | writeString(0xa0, p0) |
| 12537 | } |
| 12538 | _sendLogPayload(0x1c, 0xc4); |
| 12539 | /// @solidity memory-safe-assembly |
| 12540 | assembly { |
| 12541 | mstore(0x00, m0) |
| 12542 | mstore(0x20, m1) |
| 12543 | mstore(0x40, m2) |
| 12544 | mstore(0x60, m3) |
| 12545 | mstore(0x80, m4) |
| 12546 | mstore(0xa0, m5) |
| 12547 | mstore(0xc0, m6) |
| 12548 | } |
| 12549 | } |
| 12550 | |
| 12551 | function log(bytes32 p0, uint256 p1, bool p2, uint256 p3) internal pure { |
| 12552 | bytes32 m0; |
| 12553 | bytes32 m1; |
| 12554 | bytes32 m2; |
| 12555 | bytes32 m3; |
| 12556 | bytes32 m4; |
| 12557 | bytes32 m5; |
| 12558 | bytes32 m6; |
| 12559 | /// @solidity memory-safe-assembly |
| 12560 | assembly { |
| 12561 | function writeString(pos, w) { |
| 12562 | let length := 0 |
| 12563 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 12564 | mstore(pos, length) |
| 12565 | let shift := sub(256, shl(3, length)) |
| 12566 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 12567 | } |
| 12568 | m0 := mload(0x00) |
| 12569 | m1 := mload(0x20) |
| 12570 | m2 := mload(0x40) |
| 12571 | m3 := mload(0x60) |
| 12572 | m4 := mload(0x80) |
| 12573 | m5 := mload(0xa0) |
| 12574 | m6 := mload(0xc0) |
| 12575 | // Selector of `log(string,uint256,bool,uint256)`. |
| 12576 | mstore(0x00, 0xe41b6f6f) |
| 12577 | mstore(0x20, 0x80) |
| 12578 | mstore(0x40, p1) |
| 12579 | mstore(0x60, p2) |
| 12580 | mstore(0x80, p3) |
| 12581 | writeString(0xa0, p0) |
| 12582 | } |
| 12583 | _sendLogPayload(0x1c, 0xc4); |
| 12584 | /// @solidity memory-safe-assembly |
| 12585 | assembly { |
| 12586 | mstore(0x00, m0) |
| 12587 | mstore(0x20, m1) |
| 12588 | mstore(0x40, m2) |
| 12589 | mstore(0x60, m3) |
| 12590 | mstore(0x80, m4) |
| 12591 | mstore(0xa0, m5) |
| 12592 | mstore(0xc0, m6) |
| 12593 | } |
| 12594 | } |
| 12595 | |
| 12596 | function log(bytes32 p0, uint256 p1, bool p2, bytes32 p3) internal pure { |
| 12597 | bytes32 m0; |
| 12598 | bytes32 m1; |
| 12599 | bytes32 m2; |
| 12600 | bytes32 m3; |
| 12601 | bytes32 m4; |
| 12602 | bytes32 m5; |
| 12603 | bytes32 m6; |
| 12604 | bytes32 m7; |
| 12605 | bytes32 m8; |
| 12606 | /// @solidity memory-safe-assembly |
| 12607 | assembly { |
| 12608 | function writeString(pos, w) { |
| 12609 | let length := 0 |
| 12610 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 12611 | mstore(pos, length) |
| 12612 | let shift := sub(256, shl(3, length)) |
| 12613 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 12614 | } |
| 12615 | m0 := mload(0x00) |
| 12616 | m1 := mload(0x20) |
| 12617 | m2 := mload(0x40) |
| 12618 | m3 := mload(0x60) |
| 12619 | m4 := mload(0x80) |
| 12620 | m5 := mload(0xa0) |
| 12621 | m6 := mload(0xc0) |
| 12622 | m7 := mload(0xe0) |
| 12623 | m8 := mload(0x100) |
| 12624 | // Selector of `log(string,uint256,bool,string)`. |
| 12625 | mstore(0x00, 0xabf73a98) |
| 12626 | mstore(0x20, 0x80) |
| 12627 | mstore(0x40, p1) |
| 12628 | mstore(0x60, p2) |
| 12629 | mstore(0x80, 0xc0) |
| 12630 | writeString(0xa0, p0) |
| 12631 | writeString(0xe0, p3) |
| 12632 | } |
| 12633 | _sendLogPayload(0x1c, 0x104); |
| 12634 | /// @solidity memory-safe-assembly |
| 12635 | assembly { |
| 12636 | mstore(0x00, m0) |
| 12637 | mstore(0x20, m1) |
| 12638 | mstore(0x40, m2) |
| 12639 | mstore(0x60, m3) |
| 12640 | mstore(0x80, m4) |
| 12641 | mstore(0xa0, m5) |
| 12642 | mstore(0xc0, m6) |
| 12643 | mstore(0xe0, m7) |
| 12644 | mstore(0x100, m8) |
| 12645 | } |
| 12646 | } |
| 12647 | |
| 12648 | function log(bytes32 p0, uint256 p1, uint256 p2, address p3) internal pure { |
| 12649 | bytes32 m0; |
| 12650 | bytes32 m1; |
| 12651 | bytes32 m2; |
| 12652 | bytes32 m3; |
| 12653 | bytes32 m4; |
| 12654 | bytes32 m5; |
| 12655 | bytes32 m6; |
| 12656 | /// @solidity memory-safe-assembly |
| 12657 | assembly { |
| 12658 | function writeString(pos, w) { |
| 12659 | let length := 0 |
| 12660 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 12661 | mstore(pos, length) |
| 12662 | let shift := sub(256, shl(3, length)) |
| 12663 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 12664 | } |
| 12665 | m0 := mload(0x00) |
| 12666 | m1 := mload(0x20) |
| 12667 | m2 := mload(0x40) |
| 12668 | m3 := mload(0x60) |
| 12669 | m4 := mload(0x80) |
| 12670 | m5 := mload(0xa0) |
| 12671 | m6 := mload(0xc0) |
| 12672 | // Selector of `log(string,uint256,uint256,address)`. |
| 12673 | mstore(0x00, 0xe21de278) |
| 12674 | mstore(0x20, 0x80) |
| 12675 | mstore(0x40, p1) |
| 12676 | mstore(0x60, p2) |
| 12677 | mstore(0x80, p3) |
| 12678 | writeString(0xa0, p0) |
| 12679 | } |
| 12680 | _sendLogPayload(0x1c, 0xc4); |
| 12681 | /// @solidity memory-safe-assembly |
| 12682 | assembly { |
| 12683 | mstore(0x00, m0) |
| 12684 | mstore(0x20, m1) |
| 12685 | mstore(0x40, m2) |
| 12686 | mstore(0x60, m3) |
| 12687 | mstore(0x80, m4) |
| 12688 | mstore(0xa0, m5) |
| 12689 | mstore(0xc0, m6) |
| 12690 | } |
| 12691 | } |
| 12692 | |
| 12693 | function log(bytes32 p0, uint256 p1, uint256 p2, bool p3) internal pure { |
| 12694 | bytes32 m0; |
| 12695 | bytes32 m1; |
| 12696 | bytes32 m2; |
| 12697 | bytes32 m3; |
| 12698 | bytes32 m4; |
| 12699 | bytes32 m5; |
| 12700 | bytes32 m6; |
| 12701 | /// @solidity memory-safe-assembly |
| 12702 | assembly { |
| 12703 | function writeString(pos, w) { |
| 12704 | let length := 0 |
| 12705 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 12706 | mstore(pos, length) |
| 12707 | let shift := sub(256, shl(3, length)) |
| 12708 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 12709 | } |
| 12710 | m0 := mload(0x00) |
| 12711 | m1 := mload(0x20) |
| 12712 | m2 := mload(0x40) |
| 12713 | m3 := mload(0x60) |
| 12714 | m4 := mload(0x80) |
| 12715 | m5 := mload(0xa0) |
| 12716 | m6 := mload(0xc0) |
| 12717 | // Selector of `log(string,uint256,uint256,bool)`. |
| 12718 | mstore(0x00, 0x7626db92) |
| 12719 | mstore(0x20, 0x80) |
| 12720 | mstore(0x40, p1) |
| 12721 | mstore(0x60, p2) |
| 12722 | mstore(0x80, p3) |
| 12723 | writeString(0xa0, p0) |
| 12724 | } |
| 12725 | _sendLogPayload(0x1c, 0xc4); |
| 12726 | /// @solidity memory-safe-assembly |
| 12727 | assembly { |
| 12728 | mstore(0x00, m0) |
| 12729 | mstore(0x20, m1) |
| 12730 | mstore(0x40, m2) |
| 12731 | mstore(0x60, m3) |
| 12732 | mstore(0x80, m4) |
| 12733 | mstore(0xa0, m5) |
| 12734 | mstore(0xc0, m6) |
| 12735 | } |
| 12736 | } |
| 12737 | |
| 12738 | function log(bytes32 p0, uint256 p1, uint256 p2, uint256 p3) internal pure { |
| 12739 | bytes32 m0; |
| 12740 | bytes32 m1; |
| 12741 | bytes32 m2; |
| 12742 | bytes32 m3; |
| 12743 | bytes32 m4; |
| 12744 | bytes32 m5; |
| 12745 | bytes32 m6; |
| 12746 | /// @solidity memory-safe-assembly |
| 12747 | assembly { |
| 12748 | function writeString(pos, w) { |
| 12749 | let length := 0 |
| 12750 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 12751 | mstore(pos, length) |
| 12752 | let shift := sub(256, shl(3, length)) |
| 12753 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 12754 | } |
| 12755 | m0 := mload(0x00) |
| 12756 | m1 := mload(0x20) |
| 12757 | m2 := mload(0x40) |
| 12758 | m3 := mload(0x60) |
| 12759 | m4 := mload(0x80) |
| 12760 | m5 := mload(0xa0) |
| 12761 | m6 := mload(0xc0) |
| 12762 | // Selector of `log(string,uint256,uint256,uint256)`. |
| 12763 | mstore(0x00, 0xa7a87853) |
| 12764 | mstore(0x20, 0x80) |
| 12765 | mstore(0x40, p1) |
| 12766 | mstore(0x60, p2) |
| 12767 | mstore(0x80, p3) |
| 12768 | writeString(0xa0, p0) |
| 12769 | } |
| 12770 | _sendLogPayload(0x1c, 0xc4); |
| 12771 | /// @solidity memory-safe-assembly |
| 12772 | assembly { |
| 12773 | mstore(0x00, m0) |
| 12774 | mstore(0x20, m1) |
| 12775 | mstore(0x40, m2) |
| 12776 | mstore(0x60, m3) |
| 12777 | mstore(0x80, m4) |
| 12778 | mstore(0xa0, m5) |
| 12779 | mstore(0xc0, m6) |
| 12780 | } |
| 12781 | } |
| 12782 | |
| 12783 | function log(bytes32 p0, uint256 p1, uint256 p2, bytes32 p3) internal pure { |
| 12784 | bytes32 m0; |
| 12785 | bytes32 m1; |
| 12786 | bytes32 m2; |
| 12787 | bytes32 m3; |
| 12788 | bytes32 m4; |
| 12789 | bytes32 m5; |
| 12790 | bytes32 m6; |
| 12791 | bytes32 m7; |
| 12792 | bytes32 m8; |
| 12793 | /// @solidity memory-safe-assembly |
| 12794 | assembly { |
| 12795 | function writeString(pos, w) { |
| 12796 | let length := 0 |
| 12797 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 12798 | mstore(pos, length) |
| 12799 | let shift := sub(256, shl(3, length)) |
| 12800 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 12801 | } |
| 12802 | m0 := mload(0x00) |
| 12803 | m1 := mload(0x20) |
| 12804 | m2 := mload(0x40) |
| 12805 | m3 := mload(0x60) |
| 12806 | m4 := mload(0x80) |
| 12807 | m5 := mload(0xa0) |
| 12808 | m6 := mload(0xc0) |
| 12809 | m7 := mload(0xe0) |
| 12810 | m8 := mload(0x100) |
| 12811 | // Selector of `log(string,uint256,uint256,string)`. |
| 12812 | mstore(0x00, 0x854b3496) |
| 12813 | mstore(0x20, 0x80) |
| 12814 | mstore(0x40, p1) |
| 12815 | mstore(0x60, p2) |
| 12816 | mstore(0x80, 0xc0) |
| 12817 | writeString(0xa0, p0) |
| 12818 | writeString(0xe0, p3) |
| 12819 | } |
| 12820 | _sendLogPayload(0x1c, 0x104); |
| 12821 | /// @solidity memory-safe-assembly |
| 12822 | assembly { |
| 12823 | mstore(0x00, m0) |
| 12824 | mstore(0x20, m1) |
| 12825 | mstore(0x40, m2) |
| 12826 | mstore(0x60, m3) |
| 12827 | mstore(0x80, m4) |
| 12828 | mstore(0xa0, m5) |
| 12829 | mstore(0xc0, m6) |
| 12830 | mstore(0xe0, m7) |
| 12831 | mstore(0x100, m8) |
| 12832 | } |
| 12833 | } |
| 12834 | |
| 12835 | function log(bytes32 p0, uint256 p1, bytes32 p2, address p3) internal pure { |
| 12836 | bytes32 m0; |
| 12837 | bytes32 m1; |
| 12838 | bytes32 m2; |
| 12839 | bytes32 m3; |
| 12840 | bytes32 m4; |
| 12841 | bytes32 m5; |
| 12842 | bytes32 m6; |
| 12843 | bytes32 m7; |
| 12844 | bytes32 m8; |
| 12845 | /// @solidity memory-safe-assembly |
| 12846 | assembly { |
| 12847 | function writeString(pos, w) { |
| 12848 | let length := 0 |
| 12849 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 12850 | mstore(pos, length) |
| 12851 | let shift := sub(256, shl(3, length)) |
| 12852 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 12853 | } |
| 12854 | m0 := mload(0x00) |
| 12855 | m1 := mload(0x20) |
| 12856 | m2 := mload(0x40) |
| 12857 | m3 := mload(0x60) |
| 12858 | m4 := mload(0x80) |
| 12859 | m5 := mload(0xa0) |
| 12860 | m6 := mload(0xc0) |
| 12861 | m7 := mload(0xe0) |
| 12862 | m8 := mload(0x100) |
| 12863 | // Selector of `log(string,uint256,string,address)`. |
| 12864 | mstore(0x00, 0x7c4632a4) |
| 12865 | mstore(0x20, 0x80) |
| 12866 | mstore(0x40, p1) |
| 12867 | mstore(0x60, 0xc0) |
| 12868 | mstore(0x80, p3) |
| 12869 | writeString(0xa0, p0) |
| 12870 | writeString(0xe0, p2) |
| 12871 | } |
| 12872 | _sendLogPayload(0x1c, 0x104); |
| 12873 | /// @solidity memory-safe-assembly |
| 12874 | assembly { |
| 12875 | mstore(0x00, m0) |
| 12876 | mstore(0x20, m1) |
| 12877 | mstore(0x40, m2) |
| 12878 | mstore(0x60, m3) |
| 12879 | mstore(0x80, m4) |
| 12880 | mstore(0xa0, m5) |
| 12881 | mstore(0xc0, m6) |
| 12882 | mstore(0xe0, m7) |
| 12883 | mstore(0x100, m8) |
| 12884 | } |
| 12885 | } |
| 12886 | |
| 12887 | function log(bytes32 p0, uint256 p1, bytes32 p2, bool p3) internal pure { |
| 12888 | bytes32 m0; |
| 12889 | bytes32 m1; |
| 12890 | bytes32 m2; |
| 12891 | bytes32 m3; |
| 12892 | bytes32 m4; |
| 12893 | bytes32 m5; |
| 12894 | bytes32 m6; |
| 12895 | bytes32 m7; |
| 12896 | bytes32 m8; |
| 12897 | /// @solidity memory-safe-assembly |
| 12898 | assembly { |
| 12899 | function writeString(pos, w) { |
| 12900 | let length := 0 |
| 12901 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 12902 | mstore(pos, length) |
| 12903 | let shift := sub(256, shl(3, length)) |
| 12904 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 12905 | } |
| 12906 | m0 := mload(0x00) |
| 12907 | m1 := mload(0x20) |
| 12908 | m2 := mload(0x40) |
| 12909 | m3 := mload(0x60) |
| 12910 | m4 := mload(0x80) |
| 12911 | m5 := mload(0xa0) |
| 12912 | m6 := mload(0xc0) |
| 12913 | m7 := mload(0xe0) |
| 12914 | m8 := mload(0x100) |
| 12915 | // Selector of `log(string,uint256,string,bool)`. |
| 12916 | mstore(0x00, 0x7d24491d) |
| 12917 | mstore(0x20, 0x80) |
| 12918 | mstore(0x40, p1) |
| 12919 | mstore(0x60, 0xc0) |
| 12920 | mstore(0x80, p3) |
| 12921 | writeString(0xa0, p0) |
| 12922 | writeString(0xe0, p2) |
| 12923 | } |
| 12924 | _sendLogPayload(0x1c, 0x104); |
| 12925 | /// @solidity memory-safe-assembly |
| 12926 | assembly { |
| 12927 | mstore(0x00, m0) |
| 12928 | mstore(0x20, m1) |
| 12929 | mstore(0x40, m2) |
| 12930 | mstore(0x60, m3) |
| 12931 | mstore(0x80, m4) |
| 12932 | mstore(0xa0, m5) |
| 12933 | mstore(0xc0, m6) |
| 12934 | mstore(0xe0, m7) |
| 12935 | mstore(0x100, m8) |
| 12936 | } |
| 12937 | } |
| 12938 | |
| 12939 | function log(bytes32 p0, uint256 p1, bytes32 p2, uint256 p3) internal pure { |
| 12940 | bytes32 m0; |
| 12941 | bytes32 m1; |
| 12942 | bytes32 m2; |
| 12943 | bytes32 m3; |
| 12944 | bytes32 m4; |
| 12945 | bytes32 m5; |
| 12946 | bytes32 m6; |
| 12947 | bytes32 m7; |
| 12948 | bytes32 m8; |
| 12949 | /// @solidity memory-safe-assembly |
| 12950 | assembly { |
| 12951 | function writeString(pos, w) { |
| 12952 | let length := 0 |
| 12953 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 12954 | mstore(pos, length) |
| 12955 | let shift := sub(256, shl(3, length)) |
| 12956 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 12957 | } |
| 12958 | m0 := mload(0x00) |
| 12959 | m1 := mload(0x20) |
| 12960 | m2 := mload(0x40) |
| 12961 | m3 := mload(0x60) |
| 12962 | m4 := mload(0x80) |
| 12963 | m5 := mload(0xa0) |
| 12964 | m6 := mload(0xc0) |
| 12965 | m7 := mload(0xe0) |
| 12966 | m8 := mload(0x100) |
| 12967 | // Selector of `log(string,uint256,string,uint256)`. |
| 12968 | mstore(0x00, 0xc67ea9d1) |
| 12969 | mstore(0x20, 0x80) |
| 12970 | mstore(0x40, p1) |
| 12971 | mstore(0x60, 0xc0) |
| 12972 | mstore(0x80, p3) |
| 12973 | writeString(0xa0, p0) |
| 12974 | writeString(0xe0, p2) |
| 12975 | } |
| 12976 | _sendLogPayload(0x1c, 0x104); |
| 12977 | /// @solidity memory-safe-assembly |
| 12978 | assembly { |
| 12979 | mstore(0x00, m0) |
| 12980 | mstore(0x20, m1) |
| 12981 | mstore(0x40, m2) |
| 12982 | mstore(0x60, m3) |
| 12983 | mstore(0x80, m4) |
| 12984 | mstore(0xa0, m5) |
| 12985 | mstore(0xc0, m6) |
| 12986 | mstore(0xe0, m7) |
| 12987 | mstore(0x100, m8) |
| 12988 | } |
| 12989 | } |
| 12990 | |
| 12991 | function log(bytes32 p0, uint256 p1, bytes32 p2, bytes32 p3) internal pure { |
| 12992 | bytes32 m0; |
| 12993 | bytes32 m1; |
| 12994 | bytes32 m2; |
| 12995 | bytes32 m3; |
| 12996 | bytes32 m4; |
| 12997 | bytes32 m5; |
| 12998 | bytes32 m6; |
| 12999 | bytes32 m7; |
| 13000 | bytes32 m8; |
| 13001 | bytes32 m9; |
| 13002 | bytes32 m10; |
| 13003 | /// @solidity memory-safe-assembly |
| 13004 | assembly { |
| 13005 | function writeString(pos, w) { |
| 13006 | let length := 0 |
| 13007 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 13008 | mstore(pos, length) |
| 13009 | let shift := sub(256, shl(3, length)) |
| 13010 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 13011 | } |
| 13012 | m0 := mload(0x00) |
| 13013 | m1 := mload(0x20) |
| 13014 | m2 := mload(0x40) |
| 13015 | m3 := mload(0x60) |
| 13016 | m4 := mload(0x80) |
| 13017 | m5 := mload(0xa0) |
| 13018 | m6 := mload(0xc0) |
| 13019 | m7 := mload(0xe0) |
| 13020 | m8 := mload(0x100) |
| 13021 | m9 := mload(0x120) |
| 13022 | m10 := mload(0x140) |
| 13023 | // Selector of `log(string,uint256,string,string)`. |
| 13024 | mstore(0x00, 0x5ab84e1f) |
| 13025 | mstore(0x20, 0x80) |
| 13026 | mstore(0x40, p1) |
| 13027 | mstore(0x60, 0xc0) |
| 13028 | mstore(0x80, 0x100) |
| 13029 | writeString(0xa0, p0) |
| 13030 | writeString(0xe0, p2) |
| 13031 | writeString(0x120, p3) |
| 13032 | } |
| 13033 | _sendLogPayload(0x1c, 0x144); |
| 13034 | /// @solidity memory-safe-assembly |
| 13035 | assembly { |
| 13036 | mstore(0x00, m0) |
| 13037 | mstore(0x20, m1) |
| 13038 | mstore(0x40, m2) |
| 13039 | mstore(0x60, m3) |
| 13040 | mstore(0x80, m4) |
| 13041 | mstore(0xa0, m5) |
| 13042 | mstore(0xc0, m6) |
| 13043 | mstore(0xe0, m7) |
| 13044 | mstore(0x100, m8) |
| 13045 | mstore(0x120, m9) |
| 13046 | mstore(0x140, m10) |
| 13047 | } |
| 13048 | } |
| 13049 | |
| 13050 | function log(bytes32 p0, bytes32 p1, address p2, address p3) internal pure { |
| 13051 | bytes32 m0; |
| 13052 | bytes32 m1; |
| 13053 | bytes32 m2; |
| 13054 | bytes32 m3; |
| 13055 | bytes32 m4; |
| 13056 | bytes32 m5; |
| 13057 | bytes32 m6; |
| 13058 | bytes32 m7; |
| 13059 | bytes32 m8; |
| 13060 | /// @solidity memory-safe-assembly |
| 13061 | assembly { |
| 13062 | function writeString(pos, w) { |
| 13063 | let length := 0 |
| 13064 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 13065 | mstore(pos, length) |
| 13066 | let shift := sub(256, shl(3, length)) |
| 13067 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 13068 | } |
| 13069 | m0 := mload(0x00) |
| 13070 | m1 := mload(0x20) |
| 13071 | m2 := mload(0x40) |
| 13072 | m3 := mload(0x60) |
| 13073 | m4 := mload(0x80) |
| 13074 | m5 := mload(0xa0) |
| 13075 | m6 := mload(0xc0) |
| 13076 | m7 := mload(0xe0) |
| 13077 | m8 := mload(0x100) |
| 13078 | // Selector of `log(string,string,address,address)`. |
| 13079 | mstore(0x00, 0x439c7bef) |
| 13080 | mstore(0x20, 0x80) |
| 13081 | mstore(0x40, 0xc0) |
| 13082 | mstore(0x60, p2) |
| 13083 | mstore(0x80, p3) |
| 13084 | writeString(0xa0, p0) |
| 13085 | writeString(0xe0, p1) |
| 13086 | } |
| 13087 | _sendLogPayload(0x1c, 0x104); |
| 13088 | /// @solidity memory-safe-assembly |
| 13089 | assembly { |
| 13090 | mstore(0x00, m0) |
| 13091 | mstore(0x20, m1) |
| 13092 | mstore(0x40, m2) |
| 13093 | mstore(0x60, m3) |
| 13094 | mstore(0x80, m4) |
| 13095 | mstore(0xa0, m5) |
| 13096 | mstore(0xc0, m6) |
| 13097 | mstore(0xe0, m7) |
| 13098 | mstore(0x100, m8) |
| 13099 | } |
| 13100 | } |
| 13101 | |
| 13102 | function log(bytes32 p0, bytes32 p1, address p2, bool p3) internal pure { |
| 13103 | bytes32 m0; |
| 13104 | bytes32 m1; |
| 13105 | bytes32 m2; |
| 13106 | bytes32 m3; |
| 13107 | bytes32 m4; |
| 13108 | bytes32 m5; |
| 13109 | bytes32 m6; |
| 13110 | bytes32 m7; |
| 13111 | bytes32 m8; |
| 13112 | /// @solidity memory-safe-assembly |
| 13113 | assembly { |
| 13114 | function writeString(pos, w) { |
| 13115 | let length := 0 |
| 13116 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 13117 | mstore(pos, length) |
| 13118 | let shift := sub(256, shl(3, length)) |
| 13119 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 13120 | } |
| 13121 | m0 := mload(0x00) |
| 13122 | m1 := mload(0x20) |
| 13123 | m2 := mload(0x40) |
| 13124 | m3 := mload(0x60) |
| 13125 | m4 := mload(0x80) |
| 13126 | m5 := mload(0xa0) |
| 13127 | m6 := mload(0xc0) |
| 13128 | m7 := mload(0xe0) |
| 13129 | m8 := mload(0x100) |
| 13130 | // Selector of `log(string,string,address,bool)`. |
| 13131 | mstore(0x00, 0x5ccd4e37) |
| 13132 | mstore(0x20, 0x80) |
| 13133 | mstore(0x40, 0xc0) |
| 13134 | mstore(0x60, p2) |
| 13135 | mstore(0x80, p3) |
| 13136 | writeString(0xa0, p0) |
| 13137 | writeString(0xe0, p1) |
| 13138 | } |
| 13139 | _sendLogPayload(0x1c, 0x104); |
| 13140 | /// @solidity memory-safe-assembly |
| 13141 | assembly { |
| 13142 | mstore(0x00, m0) |
| 13143 | mstore(0x20, m1) |
| 13144 | mstore(0x40, m2) |
| 13145 | mstore(0x60, m3) |
| 13146 | mstore(0x80, m4) |
| 13147 | mstore(0xa0, m5) |
| 13148 | mstore(0xc0, m6) |
| 13149 | mstore(0xe0, m7) |
| 13150 | mstore(0x100, m8) |
| 13151 | } |
| 13152 | } |
| 13153 | |
| 13154 | function log(bytes32 p0, bytes32 p1, address p2, uint256 p3) internal pure { |
| 13155 | bytes32 m0; |
| 13156 | bytes32 m1; |
| 13157 | bytes32 m2; |
| 13158 | bytes32 m3; |
| 13159 | bytes32 m4; |
| 13160 | bytes32 m5; |
| 13161 | bytes32 m6; |
| 13162 | bytes32 m7; |
| 13163 | bytes32 m8; |
| 13164 | /// @solidity memory-safe-assembly |
| 13165 | assembly { |
| 13166 | function writeString(pos, w) { |
| 13167 | let length := 0 |
| 13168 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 13169 | mstore(pos, length) |
| 13170 | let shift := sub(256, shl(3, length)) |
| 13171 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 13172 | } |
| 13173 | m0 := mload(0x00) |
| 13174 | m1 := mload(0x20) |
| 13175 | m2 := mload(0x40) |
| 13176 | m3 := mload(0x60) |
| 13177 | m4 := mload(0x80) |
| 13178 | m5 := mload(0xa0) |
| 13179 | m6 := mload(0xc0) |
| 13180 | m7 := mload(0xe0) |
| 13181 | m8 := mload(0x100) |
| 13182 | // Selector of `log(string,string,address,uint256)`. |
| 13183 | mstore(0x00, 0x7cc3c607) |
| 13184 | mstore(0x20, 0x80) |
| 13185 | mstore(0x40, 0xc0) |
| 13186 | mstore(0x60, p2) |
| 13187 | mstore(0x80, p3) |
| 13188 | writeString(0xa0, p0) |
| 13189 | writeString(0xe0, p1) |
| 13190 | } |
| 13191 | _sendLogPayload(0x1c, 0x104); |
| 13192 | /// @solidity memory-safe-assembly |
| 13193 | assembly { |
| 13194 | mstore(0x00, m0) |
| 13195 | mstore(0x20, m1) |
| 13196 | mstore(0x40, m2) |
| 13197 | mstore(0x60, m3) |
| 13198 | mstore(0x80, m4) |
| 13199 | mstore(0xa0, m5) |
| 13200 | mstore(0xc0, m6) |
| 13201 | mstore(0xe0, m7) |
| 13202 | mstore(0x100, m8) |
| 13203 | } |
| 13204 | } |
| 13205 | |
| 13206 | function log(bytes32 p0, bytes32 p1, address p2, bytes32 p3) internal pure { |
| 13207 | bytes32 m0; |
| 13208 | bytes32 m1; |
| 13209 | bytes32 m2; |
| 13210 | bytes32 m3; |
| 13211 | bytes32 m4; |
| 13212 | bytes32 m5; |
| 13213 | bytes32 m6; |
| 13214 | bytes32 m7; |
| 13215 | bytes32 m8; |
| 13216 | bytes32 m9; |
| 13217 | bytes32 m10; |
| 13218 | /// @solidity memory-safe-assembly |
| 13219 | assembly { |
| 13220 | function writeString(pos, w) { |
| 13221 | let length := 0 |
| 13222 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 13223 | mstore(pos, length) |
| 13224 | let shift := sub(256, shl(3, length)) |
| 13225 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 13226 | } |
| 13227 | m0 := mload(0x00) |
| 13228 | m1 := mload(0x20) |
| 13229 | m2 := mload(0x40) |
| 13230 | m3 := mload(0x60) |
| 13231 | m4 := mload(0x80) |
| 13232 | m5 := mload(0xa0) |
| 13233 | m6 := mload(0xc0) |
| 13234 | m7 := mload(0xe0) |
| 13235 | m8 := mload(0x100) |
| 13236 | m9 := mload(0x120) |
| 13237 | m10 := mload(0x140) |
| 13238 | // Selector of `log(string,string,address,string)`. |
| 13239 | mstore(0x00, 0xeb1bff80) |
| 13240 | mstore(0x20, 0x80) |
| 13241 | mstore(0x40, 0xc0) |
| 13242 | mstore(0x60, p2) |
| 13243 | mstore(0x80, 0x100) |
| 13244 | writeString(0xa0, p0) |
| 13245 | writeString(0xe0, p1) |
| 13246 | writeString(0x120, p3) |
| 13247 | } |
| 13248 | _sendLogPayload(0x1c, 0x144); |
| 13249 | /// @solidity memory-safe-assembly |
| 13250 | assembly { |
| 13251 | mstore(0x00, m0) |
| 13252 | mstore(0x20, m1) |
| 13253 | mstore(0x40, m2) |
| 13254 | mstore(0x60, m3) |
| 13255 | mstore(0x80, m4) |
| 13256 | mstore(0xa0, m5) |
| 13257 | mstore(0xc0, m6) |
| 13258 | mstore(0xe0, m7) |
| 13259 | mstore(0x100, m8) |
| 13260 | mstore(0x120, m9) |
| 13261 | mstore(0x140, m10) |
| 13262 | } |
| 13263 | } |
| 13264 | |
| 13265 | function log(bytes32 p0, bytes32 p1, bool p2, address p3) internal pure { |
| 13266 | bytes32 m0; |
| 13267 | bytes32 m1; |
| 13268 | bytes32 m2; |
| 13269 | bytes32 m3; |
| 13270 | bytes32 m4; |
| 13271 | bytes32 m5; |
| 13272 | bytes32 m6; |
| 13273 | bytes32 m7; |
| 13274 | bytes32 m8; |
| 13275 | /// @solidity memory-safe-assembly |
| 13276 | assembly { |
| 13277 | function writeString(pos, w) { |
| 13278 | let length := 0 |
| 13279 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 13280 | mstore(pos, length) |
| 13281 | let shift := sub(256, shl(3, length)) |
| 13282 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 13283 | } |
| 13284 | m0 := mload(0x00) |
| 13285 | m1 := mload(0x20) |
| 13286 | m2 := mload(0x40) |
| 13287 | m3 := mload(0x60) |
| 13288 | m4 := mload(0x80) |
| 13289 | m5 := mload(0xa0) |
| 13290 | m6 := mload(0xc0) |
| 13291 | m7 := mload(0xe0) |
| 13292 | m8 := mload(0x100) |
| 13293 | // Selector of `log(string,string,bool,address)`. |
| 13294 | mstore(0x00, 0xc371c7db) |
| 13295 | mstore(0x20, 0x80) |
| 13296 | mstore(0x40, 0xc0) |
| 13297 | mstore(0x60, p2) |
| 13298 | mstore(0x80, p3) |
| 13299 | writeString(0xa0, p0) |
| 13300 | writeString(0xe0, p1) |
| 13301 | } |
| 13302 | _sendLogPayload(0x1c, 0x104); |
| 13303 | /// @solidity memory-safe-assembly |
| 13304 | assembly { |
| 13305 | mstore(0x00, m0) |
| 13306 | mstore(0x20, m1) |
| 13307 | mstore(0x40, m2) |
| 13308 | mstore(0x60, m3) |
| 13309 | mstore(0x80, m4) |
| 13310 | mstore(0xa0, m5) |
| 13311 | mstore(0xc0, m6) |
| 13312 | mstore(0xe0, m7) |
| 13313 | mstore(0x100, m8) |
| 13314 | } |
| 13315 | } |
| 13316 | |
| 13317 | function log(bytes32 p0, bytes32 p1, bool p2, bool p3) internal pure { |
| 13318 | bytes32 m0; |
| 13319 | bytes32 m1; |
| 13320 | bytes32 m2; |
| 13321 | bytes32 m3; |
| 13322 | bytes32 m4; |
| 13323 | bytes32 m5; |
| 13324 | bytes32 m6; |
| 13325 | bytes32 m7; |
| 13326 | bytes32 m8; |
| 13327 | /// @solidity memory-safe-assembly |
| 13328 | assembly { |
| 13329 | function writeString(pos, w) { |
| 13330 | let length := 0 |
| 13331 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 13332 | mstore(pos, length) |
| 13333 | let shift := sub(256, shl(3, length)) |
| 13334 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 13335 | } |
| 13336 | m0 := mload(0x00) |
| 13337 | m1 := mload(0x20) |
| 13338 | m2 := mload(0x40) |
| 13339 | m3 := mload(0x60) |
| 13340 | m4 := mload(0x80) |
| 13341 | m5 := mload(0xa0) |
| 13342 | m6 := mload(0xc0) |
| 13343 | m7 := mload(0xe0) |
| 13344 | m8 := mload(0x100) |
| 13345 | // Selector of `log(string,string,bool,bool)`. |
| 13346 | mstore(0x00, 0x40785869) |
| 13347 | mstore(0x20, 0x80) |
| 13348 | mstore(0x40, 0xc0) |
| 13349 | mstore(0x60, p2) |
| 13350 | mstore(0x80, p3) |
| 13351 | writeString(0xa0, p0) |
| 13352 | writeString(0xe0, p1) |
| 13353 | } |
| 13354 | _sendLogPayload(0x1c, 0x104); |
| 13355 | /// @solidity memory-safe-assembly |
| 13356 | assembly { |
| 13357 | mstore(0x00, m0) |
| 13358 | mstore(0x20, m1) |
| 13359 | mstore(0x40, m2) |
| 13360 | mstore(0x60, m3) |
| 13361 | mstore(0x80, m4) |
| 13362 | mstore(0xa0, m5) |
| 13363 | mstore(0xc0, m6) |
| 13364 | mstore(0xe0, m7) |
| 13365 | mstore(0x100, m8) |
| 13366 | } |
| 13367 | } |
| 13368 | |
| 13369 | function log(bytes32 p0, bytes32 p1, bool p2, uint256 p3) internal pure { |
| 13370 | bytes32 m0; |
| 13371 | bytes32 m1; |
| 13372 | bytes32 m2; |
| 13373 | bytes32 m3; |
| 13374 | bytes32 m4; |
| 13375 | bytes32 m5; |
| 13376 | bytes32 m6; |
| 13377 | bytes32 m7; |
| 13378 | bytes32 m8; |
| 13379 | /// @solidity memory-safe-assembly |
| 13380 | assembly { |
| 13381 | function writeString(pos, w) { |
| 13382 | let length := 0 |
| 13383 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 13384 | mstore(pos, length) |
| 13385 | let shift := sub(256, shl(3, length)) |
| 13386 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 13387 | } |
| 13388 | m0 := mload(0x00) |
| 13389 | m1 := mload(0x20) |
| 13390 | m2 := mload(0x40) |
| 13391 | m3 := mload(0x60) |
| 13392 | m4 := mload(0x80) |
| 13393 | m5 := mload(0xa0) |
| 13394 | m6 := mload(0xc0) |
| 13395 | m7 := mload(0xe0) |
| 13396 | m8 := mload(0x100) |
| 13397 | // Selector of `log(string,string,bool,uint256)`. |
| 13398 | mstore(0x00, 0xd6aefad2) |
| 13399 | mstore(0x20, 0x80) |
| 13400 | mstore(0x40, 0xc0) |
| 13401 | mstore(0x60, p2) |
| 13402 | mstore(0x80, p3) |
| 13403 | writeString(0xa0, p0) |
| 13404 | writeString(0xe0, p1) |
| 13405 | } |
| 13406 | _sendLogPayload(0x1c, 0x104); |
| 13407 | /// @solidity memory-safe-assembly |
| 13408 | assembly { |
| 13409 | mstore(0x00, m0) |
| 13410 | mstore(0x20, m1) |
| 13411 | mstore(0x40, m2) |
| 13412 | mstore(0x60, m3) |
| 13413 | mstore(0x80, m4) |
| 13414 | mstore(0xa0, m5) |
| 13415 | mstore(0xc0, m6) |
| 13416 | mstore(0xe0, m7) |
| 13417 | mstore(0x100, m8) |
| 13418 | } |
| 13419 | } |
| 13420 | |
| 13421 | function log(bytes32 p0, bytes32 p1, bool p2, bytes32 p3) internal pure { |
| 13422 | bytes32 m0; |
| 13423 | bytes32 m1; |
| 13424 | bytes32 m2; |
| 13425 | bytes32 m3; |
| 13426 | bytes32 m4; |
| 13427 | bytes32 m5; |
| 13428 | bytes32 m6; |
| 13429 | bytes32 m7; |
| 13430 | bytes32 m8; |
| 13431 | bytes32 m9; |
| 13432 | bytes32 m10; |
| 13433 | /// @solidity memory-safe-assembly |
| 13434 | assembly { |
| 13435 | function writeString(pos, w) { |
| 13436 | let length := 0 |
| 13437 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 13438 | mstore(pos, length) |
| 13439 | let shift := sub(256, shl(3, length)) |
| 13440 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 13441 | } |
| 13442 | m0 := mload(0x00) |
| 13443 | m1 := mload(0x20) |
| 13444 | m2 := mload(0x40) |
| 13445 | m3 := mload(0x60) |
| 13446 | m4 := mload(0x80) |
| 13447 | m5 := mload(0xa0) |
| 13448 | m6 := mload(0xc0) |
| 13449 | m7 := mload(0xe0) |
| 13450 | m8 := mload(0x100) |
| 13451 | m9 := mload(0x120) |
| 13452 | m10 := mload(0x140) |
| 13453 | // Selector of `log(string,string,bool,string)`. |
| 13454 | mstore(0x00, 0x5e84b0ea) |
| 13455 | mstore(0x20, 0x80) |
| 13456 | mstore(0x40, 0xc0) |
| 13457 | mstore(0x60, p2) |
| 13458 | mstore(0x80, 0x100) |
| 13459 | writeString(0xa0, p0) |
| 13460 | writeString(0xe0, p1) |
| 13461 | writeString(0x120, p3) |
| 13462 | } |
| 13463 | _sendLogPayload(0x1c, 0x144); |
| 13464 | /// @solidity memory-safe-assembly |
| 13465 | assembly { |
| 13466 | mstore(0x00, m0) |
| 13467 | mstore(0x20, m1) |
| 13468 | mstore(0x40, m2) |
| 13469 | mstore(0x60, m3) |
| 13470 | mstore(0x80, m4) |
| 13471 | mstore(0xa0, m5) |
| 13472 | mstore(0xc0, m6) |
| 13473 | mstore(0xe0, m7) |
| 13474 | mstore(0x100, m8) |
| 13475 | mstore(0x120, m9) |
| 13476 | mstore(0x140, m10) |
| 13477 | } |
| 13478 | } |
| 13479 | |
| 13480 | function log(bytes32 p0, bytes32 p1, uint256 p2, address p3) internal pure { |
| 13481 | bytes32 m0; |
| 13482 | bytes32 m1; |
| 13483 | bytes32 m2; |
| 13484 | bytes32 m3; |
| 13485 | bytes32 m4; |
| 13486 | bytes32 m5; |
| 13487 | bytes32 m6; |
| 13488 | bytes32 m7; |
| 13489 | bytes32 m8; |
| 13490 | /// @solidity memory-safe-assembly |
| 13491 | assembly { |
| 13492 | function writeString(pos, w) { |
| 13493 | let length := 0 |
| 13494 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 13495 | mstore(pos, length) |
| 13496 | let shift := sub(256, shl(3, length)) |
| 13497 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 13498 | } |
| 13499 | m0 := mload(0x00) |
| 13500 | m1 := mload(0x20) |
| 13501 | m2 := mload(0x40) |
| 13502 | m3 := mload(0x60) |
| 13503 | m4 := mload(0x80) |
| 13504 | m5 := mload(0xa0) |
| 13505 | m6 := mload(0xc0) |
| 13506 | m7 := mload(0xe0) |
| 13507 | m8 := mload(0x100) |
| 13508 | // Selector of `log(string,string,uint256,address)`. |
| 13509 | mstore(0x00, 0x1023f7b2) |
| 13510 | mstore(0x20, 0x80) |
| 13511 | mstore(0x40, 0xc0) |
| 13512 | mstore(0x60, p2) |
| 13513 | mstore(0x80, p3) |
| 13514 | writeString(0xa0, p0) |
| 13515 | writeString(0xe0, p1) |
| 13516 | } |
| 13517 | _sendLogPayload(0x1c, 0x104); |
| 13518 | /// @solidity memory-safe-assembly |
| 13519 | assembly { |
| 13520 | mstore(0x00, m0) |
| 13521 | mstore(0x20, m1) |
| 13522 | mstore(0x40, m2) |
| 13523 | mstore(0x60, m3) |
| 13524 | mstore(0x80, m4) |
| 13525 | mstore(0xa0, m5) |
| 13526 | mstore(0xc0, m6) |
| 13527 | mstore(0xe0, m7) |
| 13528 | mstore(0x100, m8) |
| 13529 | } |
| 13530 | } |
| 13531 | |
| 13532 | function log(bytes32 p0, bytes32 p1, uint256 p2, bool p3) internal pure { |
| 13533 | bytes32 m0; |
| 13534 | bytes32 m1; |
| 13535 | bytes32 m2; |
| 13536 | bytes32 m3; |
| 13537 | bytes32 m4; |
| 13538 | bytes32 m5; |
| 13539 | bytes32 m6; |
| 13540 | bytes32 m7; |
| 13541 | bytes32 m8; |
| 13542 | /// @solidity memory-safe-assembly |
| 13543 | assembly { |
| 13544 | function writeString(pos, w) { |
| 13545 | let length := 0 |
| 13546 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 13547 | mstore(pos, length) |
| 13548 | let shift := sub(256, shl(3, length)) |
| 13549 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 13550 | } |
| 13551 | m0 := mload(0x00) |
| 13552 | m1 := mload(0x20) |
| 13553 | m2 := mload(0x40) |
| 13554 | m3 := mload(0x60) |
| 13555 | m4 := mload(0x80) |
| 13556 | m5 := mload(0xa0) |
| 13557 | m6 := mload(0xc0) |
| 13558 | m7 := mload(0xe0) |
| 13559 | m8 := mload(0x100) |
| 13560 | // Selector of `log(string,string,uint256,bool)`. |
| 13561 | mstore(0x00, 0xc3a8a654) |
| 13562 | mstore(0x20, 0x80) |
| 13563 | mstore(0x40, 0xc0) |
| 13564 | mstore(0x60, p2) |
| 13565 | mstore(0x80, p3) |
| 13566 | writeString(0xa0, p0) |
| 13567 | writeString(0xe0, p1) |
| 13568 | } |
| 13569 | _sendLogPayload(0x1c, 0x104); |
| 13570 | /// @solidity memory-safe-assembly |
| 13571 | assembly { |
| 13572 | mstore(0x00, m0) |
| 13573 | mstore(0x20, m1) |
| 13574 | mstore(0x40, m2) |
| 13575 | mstore(0x60, m3) |
| 13576 | mstore(0x80, m4) |
| 13577 | mstore(0xa0, m5) |
| 13578 | mstore(0xc0, m6) |
| 13579 | mstore(0xe0, m7) |
| 13580 | mstore(0x100, m8) |
| 13581 | } |
| 13582 | } |
| 13583 | |
| 13584 | function log(bytes32 p0, bytes32 p1, uint256 p2, uint256 p3) internal pure { |
| 13585 | bytes32 m0; |
| 13586 | bytes32 m1; |
| 13587 | bytes32 m2; |
| 13588 | bytes32 m3; |
| 13589 | bytes32 m4; |
| 13590 | bytes32 m5; |
| 13591 | bytes32 m6; |
| 13592 | bytes32 m7; |
| 13593 | bytes32 m8; |
| 13594 | /// @solidity memory-safe-assembly |
| 13595 | assembly { |
| 13596 | function writeString(pos, w) { |
| 13597 | let length := 0 |
| 13598 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 13599 | mstore(pos, length) |
| 13600 | let shift := sub(256, shl(3, length)) |
| 13601 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 13602 | } |
| 13603 | m0 := mload(0x00) |
| 13604 | m1 := mload(0x20) |
| 13605 | m2 := mload(0x40) |
| 13606 | m3 := mload(0x60) |
| 13607 | m4 := mload(0x80) |
| 13608 | m5 := mload(0xa0) |
| 13609 | m6 := mload(0xc0) |
| 13610 | m7 := mload(0xe0) |
| 13611 | m8 := mload(0x100) |
| 13612 | // Selector of `log(string,string,uint256,uint256)`. |
| 13613 | mstore(0x00, 0xf45d7d2c) |
| 13614 | mstore(0x20, 0x80) |
| 13615 | mstore(0x40, 0xc0) |
| 13616 | mstore(0x60, p2) |
| 13617 | mstore(0x80, p3) |
| 13618 | writeString(0xa0, p0) |
| 13619 | writeString(0xe0, p1) |
| 13620 | } |
| 13621 | _sendLogPayload(0x1c, 0x104); |
| 13622 | /// @solidity memory-safe-assembly |
| 13623 | assembly { |
| 13624 | mstore(0x00, m0) |
| 13625 | mstore(0x20, m1) |
| 13626 | mstore(0x40, m2) |
| 13627 | mstore(0x60, m3) |
| 13628 | mstore(0x80, m4) |
| 13629 | mstore(0xa0, m5) |
| 13630 | mstore(0xc0, m6) |
| 13631 | mstore(0xe0, m7) |
| 13632 | mstore(0x100, m8) |
| 13633 | } |
| 13634 | } |
| 13635 | |
| 13636 | function log(bytes32 p0, bytes32 p1, uint256 p2, bytes32 p3) internal pure { |
| 13637 | bytes32 m0; |
| 13638 | bytes32 m1; |
| 13639 | bytes32 m2; |
| 13640 | bytes32 m3; |
| 13641 | bytes32 m4; |
| 13642 | bytes32 m5; |
| 13643 | bytes32 m6; |
| 13644 | bytes32 m7; |
| 13645 | bytes32 m8; |
| 13646 | bytes32 m9; |
| 13647 | bytes32 m10; |
| 13648 | /// @solidity memory-safe-assembly |
| 13649 | assembly { |
| 13650 | function writeString(pos, w) { |
| 13651 | let length := 0 |
| 13652 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 13653 | mstore(pos, length) |
| 13654 | let shift := sub(256, shl(3, length)) |
| 13655 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 13656 | } |
| 13657 | m0 := mload(0x00) |
| 13658 | m1 := mload(0x20) |
| 13659 | m2 := mload(0x40) |
| 13660 | m3 := mload(0x60) |
| 13661 | m4 := mload(0x80) |
| 13662 | m5 := mload(0xa0) |
| 13663 | m6 := mload(0xc0) |
| 13664 | m7 := mload(0xe0) |
| 13665 | m8 := mload(0x100) |
| 13666 | m9 := mload(0x120) |
| 13667 | m10 := mload(0x140) |
| 13668 | // Selector of `log(string,string,uint256,string)`. |
| 13669 | mstore(0x00, 0x5d1a971a) |
| 13670 | mstore(0x20, 0x80) |
| 13671 | mstore(0x40, 0xc0) |
| 13672 | mstore(0x60, p2) |
| 13673 | mstore(0x80, 0x100) |
| 13674 | writeString(0xa0, p0) |
| 13675 | writeString(0xe0, p1) |
| 13676 | writeString(0x120, p3) |
| 13677 | } |
| 13678 | _sendLogPayload(0x1c, 0x144); |
| 13679 | /// @solidity memory-safe-assembly |
| 13680 | assembly { |
| 13681 | mstore(0x00, m0) |
| 13682 | mstore(0x20, m1) |
| 13683 | mstore(0x40, m2) |
| 13684 | mstore(0x60, m3) |
| 13685 | mstore(0x80, m4) |
| 13686 | mstore(0xa0, m5) |
| 13687 | mstore(0xc0, m6) |
| 13688 | mstore(0xe0, m7) |
| 13689 | mstore(0x100, m8) |
| 13690 | mstore(0x120, m9) |
| 13691 | mstore(0x140, m10) |
| 13692 | } |
| 13693 | } |
| 13694 | |
| 13695 | function log(bytes32 p0, bytes32 p1, bytes32 p2, address p3) internal pure { |
| 13696 | bytes32 m0; |
| 13697 | bytes32 m1; |
| 13698 | bytes32 m2; |
| 13699 | bytes32 m3; |
| 13700 | bytes32 m4; |
| 13701 | bytes32 m5; |
| 13702 | bytes32 m6; |
| 13703 | bytes32 m7; |
| 13704 | bytes32 m8; |
| 13705 | bytes32 m9; |
| 13706 | bytes32 m10; |
| 13707 | /// @solidity memory-safe-assembly |
| 13708 | assembly { |
| 13709 | function writeString(pos, w) { |
| 13710 | let length := 0 |
| 13711 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 13712 | mstore(pos, length) |
| 13713 | let shift := sub(256, shl(3, length)) |
| 13714 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 13715 | } |
| 13716 | m0 := mload(0x00) |
| 13717 | m1 := mload(0x20) |
| 13718 | m2 := mload(0x40) |
| 13719 | m3 := mload(0x60) |
| 13720 | m4 := mload(0x80) |
| 13721 | m5 := mload(0xa0) |
| 13722 | m6 := mload(0xc0) |
| 13723 | m7 := mload(0xe0) |
| 13724 | m8 := mload(0x100) |
| 13725 | m9 := mload(0x120) |
| 13726 | m10 := mload(0x140) |
| 13727 | // Selector of `log(string,string,string,address)`. |
| 13728 | mstore(0x00, 0x6d572f44) |
| 13729 | mstore(0x20, 0x80) |
| 13730 | mstore(0x40, 0xc0) |
| 13731 | mstore(0x60, 0x100) |
| 13732 | mstore(0x80, p3) |
| 13733 | writeString(0xa0, p0) |
| 13734 | writeString(0xe0, p1) |
| 13735 | writeString(0x120, p2) |
| 13736 | } |
| 13737 | _sendLogPayload(0x1c, 0x144); |
| 13738 | /// @solidity memory-safe-assembly |
| 13739 | assembly { |
| 13740 | mstore(0x00, m0) |
| 13741 | mstore(0x20, m1) |
| 13742 | mstore(0x40, m2) |
| 13743 | mstore(0x60, m3) |
| 13744 | mstore(0x80, m4) |
| 13745 | mstore(0xa0, m5) |
| 13746 | mstore(0xc0, m6) |
| 13747 | mstore(0xe0, m7) |
| 13748 | mstore(0x100, m8) |
| 13749 | mstore(0x120, m9) |
| 13750 | mstore(0x140, m10) |
| 13751 | } |
| 13752 | } |
| 13753 | |
| 13754 | function log(bytes32 p0, bytes32 p1, bytes32 p2, bool p3) internal pure { |
| 13755 | bytes32 m0; |
| 13756 | bytes32 m1; |
| 13757 | bytes32 m2; |
| 13758 | bytes32 m3; |
| 13759 | bytes32 m4; |
| 13760 | bytes32 m5; |
| 13761 | bytes32 m6; |
| 13762 | bytes32 m7; |
| 13763 | bytes32 m8; |
| 13764 | bytes32 m9; |
| 13765 | bytes32 m10; |
| 13766 | /// @solidity memory-safe-assembly |
| 13767 | assembly { |
| 13768 | function writeString(pos, w) { |
| 13769 | let length := 0 |
| 13770 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 13771 | mstore(pos, length) |
| 13772 | let shift := sub(256, shl(3, length)) |
| 13773 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 13774 | } |
| 13775 | m0 := mload(0x00) |
| 13776 | m1 := mload(0x20) |
| 13777 | m2 := mload(0x40) |
| 13778 | m3 := mload(0x60) |
| 13779 | m4 := mload(0x80) |
| 13780 | m5 := mload(0xa0) |
| 13781 | m6 := mload(0xc0) |
| 13782 | m7 := mload(0xe0) |
| 13783 | m8 := mload(0x100) |
| 13784 | m9 := mload(0x120) |
| 13785 | m10 := mload(0x140) |
| 13786 | // Selector of `log(string,string,string,bool)`. |
| 13787 | mstore(0x00, 0x2c1754ed) |
| 13788 | mstore(0x20, 0x80) |
| 13789 | mstore(0x40, 0xc0) |
| 13790 | mstore(0x60, 0x100) |
| 13791 | mstore(0x80, p3) |
| 13792 | writeString(0xa0, p0) |
| 13793 | writeString(0xe0, p1) |
| 13794 | writeString(0x120, p2) |
| 13795 | } |
| 13796 | _sendLogPayload(0x1c, 0x144); |
| 13797 | /// @solidity memory-safe-assembly |
| 13798 | assembly { |
| 13799 | mstore(0x00, m0) |
| 13800 | mstore(0x20, m1) |
| 13801 | mstore(0x40, m2) |
| 13802 | mstore(0x60, m3) |
| 13803 | mstore(0x80, m4) |
| 13804 | mstore(0xa0, m5) |
| 13805 | mstore(0xc0, m6) |
| 13806 | mstore(0xe0, m7) |
| 13807 | mstore(0x100, m8) |
| 13808 | mstore(0x120, m9) |
| 13809 | mstore(0x140, m10) |
| 13810 | } |
| 13811 | } |
| 13812 | |
| 13813 | function log(bytes32 p0, bytes32 p1, bytes32 p2, uint256 p3) internal pure { |
| 13814 | bytes32 m0; |
| 13815 | bytes32 m1; |
| 13816 | bytes32 m2; |
| 13817 | bytes32 m3; |
| 13818 | bytes32 m4; |
| 13819 | bytes32 m5; |
| 13820 | bytes32 m6; |
| 13821 | bytes32 m7; |
| 13822 | bytes32 m8; |
| 13823 | bytes32 m9; |
| 13824 | bytes32 m10; |
| 13825 | /// @solidity memory-safe-assembly |
| 13826 | assembly { |
| 13827 | function writeString(pos, w) { |
| 13828 | let length := 0 |
| 13829 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 13830 | mstore(pos, length) |
| 13831 | let shift := sub(256, shl(3, length)) |
| 13832 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 13833 | } |
| 13834 | m0 := mload(0x00) |
| 13835 | m1 := mload(0x20) |
| 13836 | m2 := mload(0x40) |
| 13837 | m3 := mload(0x60) |
| 13838 | m4 := mload(0x80) |
| 13839 | m5 := mload(0xa0) |
| 13840 | m6 := mload(0xc0) |
| 13841 | m7 := mload(0xe0) |
| 13842 | m8 := mload(0x100) |
| 13843 | m9 := mload(0x120) |
| 13844 | m10 := mload(0x140) |
| 13845 | // Selector of `log(string,string,string,uint256)`. |
| 13846 | mstore(0x00, 0x8eafb02b) |
| 13847 | mstore(0x20, 0x80) |
| 13848 | mstore(0x40, 0xc0) |
| 13849 | mstore(0x60, 0x100) |
| 13850 | mstore(0x80, p3) |
| 13851 | writeString(0xa0, p0) |
| 13852 | writeString(0xe0, p1) |
| 13853 | writeString(0x120, p2) |
| 13854 | } |
| 13855 | _sendLogPayload(0x1c, 0x144); |
| 13856 | /// @solidity memory-safe-assembly |
| 13857 | assembly { |
| 13858 | mstore(0x00, m0) |
| 13859 | mstore(0x20, m1) |
| 13860 | mstore(0x40, m2) |
| 13861 | mstore(0x60, m3) |
| 13862 | mstore(0x80, m4) |
| 13863 | mstore(0xa0, m5) |
| 13864 | mstore(0xc0, m6) |
| 13865 | mstore(0xe0, m7) |
| 13866 | mstore(0x100, m8) |
| 13867 | mstore(0x120, m9) |
| 13868 | mstore(0x140, m10) |
| 13869 | } |
| 13870 | } |
| 13871 | |
| 13872 | function log(bytes32 p0, bytes32 p1, bytes32 p2, bytes32 p3) internal pure { |
| 13873 | bytes32 m0; |
| 13874 | bytes32 m1; |
| 13875 | bytes32 m2; |
| 13876 | bytes32 m3; |
| 13877 | bytes32 m4; |
| 13878 | bytes32 m5; |
| 13879 | bytes32 m6; |
| 13880 | bytes32 m7; |
| 13881 | bytes32 m8; |
| 13882 | bytes32 m9; |
| 13883 | bytes32 m10; |
| 13884 | bytes32 m11; |
| 13885 | bytes32 m12; |
| 13886 | /// @solidity memory-safe-assembly |
| 13887 | assembly { |
| 13888 | function writeString(pos, w) { |
| 13889 | let length := 0 |
| 13890 | for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } |
| 13891 | mstore(pos, length) |
| 13892 | let shift := sub(256, shl(3, length)) |
| 13893 | mstore(add(pos, 0x20), shl(shift, shr(shift, w))) |
| 13894 | } |
| 13895 | m0 := mload(0x00) |
| 13896 | m1 := mload(0x20) |
| 13897 | m2 := mload(0x40) |
| 13898 | m3 := mload(0x60) |
| 13899 | m4 := mload(0x80) |
| 13900 | m5 := mload(0xa0) |
| 13901 | m6 := mload(0xc0) |
| 13902 | m7 := mload(0xe0) |
| 13903 | m8 := mload(0x100) |
| 13904 | m9 := mload(0x120) |
| 13905 | m10 := mload(0x140) |
| 13906 | m11 := mload(0x160) |
| 13907 | m12 := mload(0x180) |
| 13908 | // Selector of `log(string,string,string,string)`. |
| 13909 | mstore(0x00, 0xde68f20a) |
| 13910 | mstore(0x20, 0x80) |
| 13911 | mstore(0x40, 0xc0) |
| 13912 | mstore(0x60, 0x100) |
| 13913 | mstore(0x80, 0x140) |
| 13914 | writeString(0xa0, p0) |
| 13915 | writeString(0xe0, p1) |
| 13916 | writeString(0x120, p2) |
| 13917 | writeString(0x160, p3) |
| 13918 | } |
| 13919 | _sendLogPayload(0x1c, 0x184); |
| 13920 | /// @solidity memory-safe-assembly |
| 13921 | assembly { |
| 13922 | mstore(0x00, m0) |
| 13923 | mstore(0x20, m1) |
| 13924 | mstore(0x40, m2) |
| 13925 | mstore(0x60, m3) |
| 13926 | mstore(0x80, m4) |
| 13927 | mstore(0xa0, m5) |
| 13928 | mstore(0xc0, m6) |
| 13929 | mstore(0xe0, m7) |
| 13930 | mstore(0x100, m8) |
| 13931 | mstore(0x120, m9) |
| 13932 | mstore(0x140, m10) |
| 13933 | mstore(0x160, m11) |
| 13934 | mstore(0x180, m12) |
| 13935 | } |
| 13936 | } |
| 13937 | } |
| 13938 |
0.0%
lib/openzeppelin-contracts/contracts/interfaces/IERC1363.sol
Lines covered: 0 / 0 (0.0%)
| 1 | // SPDX-License-Identifier: MIT |
| 2 | // OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC1363.sol) |
| 3 | |
| 4 | pragma solidity >=0.6.2; |
| 5 | |
| 6 | import {IERC20} from "./IERC20.sol"; |
| 7 | import {IERC165} from "./IERC165.sol"; |
| 8 | |
| 9 | /** |
| 10 | * @title IERC1363 |
| 11 | * @dev Interface of the ERC-1363 standard as defined in the https://eips.ethereum.org/EIPS/eip-1363[ERC-1363]. |
| 12 | * |
| 13 | * Defines an extension interface for ERC-20 tokens that supports executing code on a recipient contract |
| 14 | * after `transfer` or `transferFrom`, or code on a spender contract after `approve`, in a single transaction. |
| 15 | */ |
| 16 | interface IERC1363 is IERC20, IERC165 { |
| 17 | /* |
| 18 | * Note: the ERC-165 identifier for this interface is 0xb0202a11. |
| 19 | * 0xb0202a11 === |
| 20 | * bytes4(keccak256('transferAndCall(address,uint256)')) ^ |
| 21 | * bytes4(keccak256('transferAndCall(address,uint256,bytes)')) ^ |
| 22 | * bytes4(keccak256('transferFromAndCall(address,address,uint256)')) ^ |
| 23 | * bytes4(keccak256('transferFromAndCall(address,address,uint256,bytes)')) ^ |
| 24 | * bytes4(keccak256('approveAndCall(address,uint256)')) ^ |
| 25 | * bytes4(keccak256('approveAndCall(address,uint256,bytes)')) |
| 26 | */ |
| 27 | |
| 28 | /** |
| 29 | * @dev Moves a `value` amount of tokens from the caller's account to `to` |
| 30 | * and then calls {IERC1363Receiver-onTransferReceived} on `to`. |
| 31 | * @param to The address which you want to transfer to. |
| 32 | * @param value The amount of tokens to be transferred. |
| 33 | * @return A boolean value indicating whether the operation succeeded unless throwing. |
| 34 | */ |
| 35 | function transferAndCall(address to, uint256 value) external returns (bool); |
| 36 | |
| 37 | /** |
| 38 | * @dev Moves a `value` amount of tokens from the caller's account to `to` |
| 39 | * and then calls {IERC1363Receiver-onTransferReceived} on `to`. |
| 40 | * @param to The address which you want to transfer to. |
| 41 | * @param value The amount of tokens to be transferred. |
| 42 | * @param data Additional data with no specified format, sent in call to `to`. |
| 43 | * @return A boolean value indicating whether the operation succeeded unless throwing. |
| 44 | */ |
| 45 | function transferAndCall(address to, uint256 value, bytes calldata data) external returns (bool); |
| 46 | |
| 47 | /** |
| 48 | * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism |
| 49 | * and then calls {IERC1363Receiver-onTransferReceived} on `to`. |
| 50 | * @param from The address which you want to send tokens from. |
| 51 | * @param to The address which you want to transfer to. |
| 52 | * @param value The amount of tokens to be transferred. |
| 53 | * @return A boolean value indicating whether the operation succeeded unless throwing. |
| 54 | */ |
| 55 | function transferFromAndCall(address from, address to, uint256 value) external returns (bool); |
| 56 | |
| 57 | /** |
| 58 | * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism |
| 59 | * and then calls {IERC1363Receiver-onTransferReceived} on `to`. |
| 60 | * @param from The address which you want to send tokens from. |
| 61 | * @param to The address which you want to transfer to. |
| 62 | * @param value The amount of tokens to be transferred. |
| 63 | * @param data Additional data with no specified format, sent in call to `to`. |
| 64 | * @return A boolean value indicating whether the operation succeeded unless throwing. |
| 65 | */ |
| 66 | function transferFromAndCall(address from, address to, uint256 value, bytes calldata data) external returns (bool); |
| 67 | |
| 68 | /** |
| 69 | * @dev Sets a `value` amount of tokens as the allowance of `spender` over the |
| 70 | * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`. |
| 71 | * @param spender The address which will spend the funds. |
| 72 | * @param value The amount of tokens to be spent. |
| 73 | * @return A boolean value indicating whether the operation succeeded unless throwing. |
| 74 | */ |
| 75 | function approveAndCall(address spender, uint256 value) external returns (bool); |
| 76 | |
| 77 | /** |
| 78 | * @dev Sets a `value` amount of tokens as the allowance of `spender` over the |
| 79 | * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`. |
| 80 | * @param spender The address which will spend the funds. |
| 81 | * @param value The amount of tokens to be spent. |
| 82 | * @param data Additional data with no specified format, sent in call to `spender`. |
| 83 | * @return A boolean value indicating whether the operation succeeded unless throwing. |
| 84 | */ |
| 85 | function approveAndCall(address spender, uint256 value, bytes calldata data) external returns (bool); |
| 86 | } |
| 87 |
0.0%
lib/openzeppelin-contracts/contracts/interfaces/IERC165.sol
Lines covered: 0 / 0 (0.0%)
| 1 | // SPDX-License-Identifier: MIT |
| 2 | // OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC165.sol) |
| 3 | |
| 4 | pragma solidity >=0.4.16; |
| 5 | |
| 6 | import {IERC165} from "../utils/introspection/IERC165.sol"; |
| 7 |
0.0%
lib/openzeppelin-contracts/contracts/interfaces/IERC20.sol
Lines covered: 0 / 0 (0.0%)
| 1 | // SPDX-License-Identifier: MIT |
| 2 | // OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC20.sol) |
| 3 | |
| 4 | pragma solidity >=0.4.16; |
| 5 | |
| 6 | import {IERC20} from "../token/ERC20/IERC20.sol"; |
| 7 |
0.0%
lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol
Lines covered: 0 / 0 (0.0%)
| 1 | // SPDX-License-Identifier: MIT |
| 2 | // OpenZeppelin Contracts (last updated v5.4.0) (token/ERC20/IERC20.sol) |
| 3 | |
| 4 | pragma solidity >=0.4.16; |
| 5 | |
| 6 | /** |
| 7 | * @dev Interface of the ERC-20 standard as defined in the ERC. |
| 8 | */ |
| 9 | interface IERC20 { |
| 10 | /** |
| 11 | * @dev Emitted when `value` tokens are moved from one account (`from`) to |
| 12 | * another (`to`). |
| 13 | * |
| 14 | * Note that `value` may be zero. |
| 15 | */ |
| 16 | event Transfer(address indexed from, address indexed to, uint256 value); |
| 17 | |
| 18 | /** |
| 19 | * @dev Emitted when the allowance of a `spender` for an `owner` is set by |
| 20 | * a call to {approve}. `value` is the new allowance. |
| 21 | */ |
| 22 | event Approval(address indexed owner, address indexed spender, uint256 value); |
| 23 | |
| 24 | /** |
| 25 | * @dev Returns the value of tokens in existence. |
| 26 | */ |
| 27 | function totalSupply() external view returns (uint256); |
| 28 | |
| 29 | /** |
| 30 | * @dev Returns the value of tokens owned by `account`. |
| 31 | */ |
| 32 | function balanceOf(address account) external view returns (uint256); |
| 33 | |
| 34 | /** |
| 35 | * @dev Moves a `value` amount of tokens from the caller's account to `to`. |
| 36 | * |
| 37 | * Returns a boolean value indicating whether the operation succeeded. |
| 38 | * |
| 39 | * Emits a {Transfer} event. |
| 40 | */ |
| 41 | function transfer(address to, uint256 value) external returns (bool); |
| 42 | |
| 43 | /** |
| 44 | * @dev Returns the remaining number of tokens that `spender` will be |
| 45 | * allowed to spend on behalf of `owner` through {transferFrom}. This is |
| 46 | * zero by default. |
| 47 | * |
| 48 | * This value changes when {approve} or {transferFrom} are called. |
| 49 | */ |
| 50 | function allowance(address owner, address spender) external view returns (uint256); |
| 51 | |
| 52 | /** |
| 53 | * @dev Sets a `value` amount of tokens as the allowance of `spender` over the |
| 54 | * caller's tokens. |
| 55 | * |
| 56 | * Returns a boolean value indicating whether the operation succeeded. |
| 57 | * |
| 58 | * IMPORTANT: Beware that changing an allowance with this method brings the risk |
| 59 | * that someone may use both the old and the new allowance by unfortunate |
| 60 | * transaction ordering. One possible solution to mitigate this race |
| 61 | * condition is to first reduce the spender's allowance to 0 and set the |
| 62 | * desired value afterwards: |
| 63 | * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 |
| 64 | * |
| 65 | * Emits an {Approval} event. |
| 66 | */ |
| 67 | function approve(address spender, uint256 value) external returns (bool); |
| 68 | |
| 69 | /** |
| 70 | * @dev Moves a `value` amount of tokens from `from` to `to` using the |
| 71 | * allowance mechanism. `value` is then deducted from the caller's |
| 72 | * allowance. |
| 73 | * |
| 74 | * Returns a boolean value indicating whether the operation succeeded. |
| 75 | * |
| 76 | * Emits a {Transfer} event. |
| 77 | */ |
| 78 | function transferFrom(address from, address to, uint256 value) external returns (bool); |
| 79 | } |
| 80 |
25.0%
lib/openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol
Lines covered: 2 / 8 (25.0%)
| 1 | // SPDX-License-Identifier: MIT |
| 2 | // OpenZeppelin Contracts (last updated v5.5.0) (token/ERC20/utils/SafeERC20.sol) |
| 3 | |
| 4 | pragma solidity ^0.8.20; |
| 5 | |
| 6 | import {IERC20} from "../IERC20.sol"; |
| 7 | import {IERC1363} from "../../../interfaces/IERC1363.sol"; |
| 8 | |
| 9 | /** |
| 10 | * @title SafeERC20 |
| 11 | * @dev Wrappers around ERC-20 operations that throw on failure (when the token |
| 12 | * contract returns false). Tokens that return no value (and instead revert or |
| 13 | * throw on failure) are also supported, non-reverting calls are assumed to be |
| 14 | * successful. |
| 15 | * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, |
| 16 | * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. |
| 17 | */ |
| 18 | library SafeERC20 { |
| 19 | /** |
| 20 | * @dev An operation with an ERC-20 token failed. |
| 21 | */ |
| 22 | error SafeERC20FailedOperation(address token); |
| 23 | |
| 24 | /** |
| 25 | * @dev Indicates a failed `decreaseAllowance` request. |
| 26 | */ |
| 27 | error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease); |
| 28 | |
| 29 | /** |
| 30 | * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value, |
| 31 | * non-reverting calls are assumed to be successful. |
| 32 | */ |
| 33 | function safeTransfer(IERC20 token, address to, uint256 value) internal { |
| 34 | if (!_safeTransfer(token, to, value, true)) { |
| 35 | revert SafeERC20FailedOperation(address(token)); |
| 36 | } |
| 37 | } |
| 38 | |
| 39 | /** |
| 40 | * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the |
| 41 | * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful. |
| 42 | */ |
| 43 | function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { |
| 44 | if (!_safeTransferFrom(token, from, to, value, true)) { |
| 45 | revert SafeERC20FailedOperation(address(token)); |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | /** |
| 50 | * @dev Variant of {safeTransfer} that returns a bool instead of reverting if the operation is not successful. |
| 51 | */ |
| 52 | function trySafeTransfer(IERC20 token, address to, uint256 value) internal returns (bool) { |
| 53 | return _safeTransfer(token, to, value, false); |
| 54 | } |
| 55 | |
| 56 | /** |
| 57 | * @dev Variant of {safeTransferFrom} that returns a bool instead of reverting if the operation is not successful. |
| 58 | */ |
| 59 | function trySafeTransferFrom(IERC20 token, address from, address to, uint256 value) internal returns (bool) { |
| 60 | return _safeTransferFrom(token, from, to, value, false); |
| 61 | } |
| 62 | |
| 63 | /** |
| 64 | * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value, |
| 65 | * non-reverting calls are assumed to be successful. |
| 66 | * |
| 67 | * IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client" |
| 68 | * smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using |
| 69 | * this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract |
| 70 | * that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior. |
| 71 | */ |
| 72 | function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { |
| 73 | uint256 oldAllowance = token.allowance(address(this), spender); |
| 74 | forceApprove(token, spender, oldAllowance + value); |
| 75 | } |
| 76 | |
| 77 | /** |
| 78 | * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no |
| 79 | * value, non-reverting calls are assumed to be successful. |
| 80 | * |
| 81 | * IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client" |
| 82 | * smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using |
| 83 | * this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract |
| 84 | * that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior. |
| 85 | */ |
| 86 | function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal { |
| 87 | unchecked { |
| 88 | uint256 currentAllowance = token.allowance(address(this), spender); |
| 89 | if (currentAllowance < requestedDecrease) { |
| 90 | revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease); |
| 91 | } |
| 92 | forceApprove(token, spender, currentAllowance - requestedDecrease); |
| 93 | } |
| 94 | } |
| 95 | |
| 96 | /** |
| 97 | * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value, |
| 98 | * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval |
| 99 | * to be set to zero before setting it to a non-zero value, such as USDT. |
| 100 | * |
| 101 | * NOTE: If the token implements ERC-7674, this function will not modify any temporary allowance. This function |
| 102 | * only sets the "standard" allowance. Any temporary allowance will remain active, in addition to the value being |
| 103 | * set here. |
| 104 | */ |
| 105 | function forceApprove(IERC20 token, address spender, uint256 value) internal { |
| 106 | if (!_safeApprove(token, spender, value, false)) { |
| 107 | if (!_safeApprove(token, spender, 0, true)) revert SafeERC20FailedOperation(address(token)); |
| 108 | if (!_safeApprove(token, spender, value, true)) revert SafeERC20FailedOperation(address(token)); |
| 109 | } |
| 110 | } |
| 111 | |
| 112 | /** |
| 113 | * @dev Performs an {ERC1363} transferAndCall, with a fallback to the simple {ERC20} transfer if the target has no |
| 114 | * code. This can be used to implement an {ERC721}-like safe transfer that relies on {ERC1363} checks when |
| 115 | * targeting contracts. |
| 116 | * |
| 117 | * Reverts if the returned value is other than `true`. |
| 118 | */ |
| 119 | function transferAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal { |
| 120 | if (to.code.length == 0) { |
| 121 | safeTransfer(token, to, value); |
| 122 | } else if (!token.transferAndCall(to, value, data)) { |
| 123 | revert SafeERC20FailedOperation(address(token)); |
| 124 | } |
| 125 | } |
| 126 | |
| 127 | /** |
| 128 | * @dev Performs an {ERC1363} transferFromAndCall, with a fallback to the simple {ERC20} transferFrom if the target |
| 129 | * has no code. This can be used to implement an {ERC721}-like safe transfer that relies on {ERC1363} checks when |
| 130 | * targeting contracts. |
| 131 | * |
| 132 | * Reverts if the returned value is other than `true`. |
| 133 | */ |
| 134 | function transferFromAndCallRelaxed( |
| 135 | IERC1363 token, |
| 136 | address from, |
| 137 | address to, |
| 138 | uint256 value, |
| 139 | bytes memory data |
| 140 | ) internal { |
| 141 | if (to.code.length == 0) { |
| 142 | safeTransferFrom(token, from, to, value); |
| 143 | } else if (!token.transferFromAndCall(from, to, value, data)) { |
| 144 | revert SafeERC20FailedOperation(address(token)); |
| 145 | } |
| 146 | } |
| 147 | |
| 148 | /** |
| 149 | * @dev Performs an {ERC1363} approveAndCall, with a fallback to the simple {ERC20} approve if the target has no |
| 150 | * code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when |
| 151 | * targeting contracts. |
| 152 | * |
| 153 | * NOTE: When the recipient address (`to`) has no code (i.e. is an EOA), this function behaves as {forceApprove}. |
| 154 | * Oppositely, when the recipient address (`to`) has code, this function only attempts to call {ERC1363-approveAndCall} |
| 155 | * once without retrying, and relies on the returned value to be true. |
| 156 | * |
| 157 | * Reverts if the returned value is other than `true`. |
| 158 | */ |
| 159 | function approveAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal { |
| 160 | if (to.code.length == 0) { |
| 161 | forceApprove(token, to, value); |
| 162 | } else if (!token.approveAndCall(to, value, data)) { |
| 163 | revert SafeERC20FailedOperation(address(token)); |
| 164 | } |
| 165 | } |
| 166 | |
| 167 | /** |
| 168 | * @dev Imitates a Solidity `token.transfer(to, value)` call, relaxing the requirement on the return value: the |
| 169 | * return value is optional (but if data is returned, it must not be false). |
| 170 | * |
| 171 | * @param token The token targeted by the call. |
| 172 | * @param to The recipient of the tokens |
| 173 | * @param value The amount of token to transfer |
| 174 | * @param bubble Behavior switch if the transfer call reverts: bubble the revert reason or return a false boolean. |
| 175 | */ |
| 176 | function _safeTransfer(IERC20 token, address to, uint256 value, bool bubble) private returns (bool success) { |
| 177 | bytes4 selector = IERC20.transfer.selector; |
| 178 | |
| 179 | assembly ("memory-safe") { |
| 180 | let fmp := mload(0x40) |
| 181 | mstore(0x00, selector) |
| 182 | mstore(0x04, and(to, shr(96, not(0)))) |
| 183 | mstore(0x24, value) |
| 184 | success := call(gas(), token, 0, 0x00, 0x44, 0x00, 0x20) |
| 185 | // if call success and return is true, all is good. |
| 186 | // otherwise (not success or return is not true), we need to perform further checks |
| 187 | if iszero(and(success, eq(mload(0x00), 1))) { |
| 188 | // if the call was a failure and bubble is enabled, bubble the error |
| 189 | if and(iszero(success), bubble) { |
| 190 | returndatacopy(fmp, 0x00, returndatasize()) |
| 191 | revert(fmp, returndatasize()) |
| 192 | } |
| 193 | // if the return value is not true, then the call is only successful if: |
| 194 | // - the token address has code |
| 195 | // - the returndata is empty |
| 196 | success := and(success, and(iszero(returndatasize()), gt(extcodesize(token), 0))) |
| 197 | } |
| 198 | mstore(0x40, fmp) |
| 199 | } |
| 200 | } |
| 201 | |
| 202 | /** |
| 203 | * @dev Imitates a Solidity `token.transferFrom(from, to, value)` call, relaxing the requirement on the return |
| 204 | * value: the return value is optional (but if data is returned, it must not be false). |
| 205 | * |
| 206 | * @param token The token targeted by the call. |
| 207 | * @param from The sender of the tokens |
| 208 | * @param to The recipient of the tokens |
| 209 | * @param value The amount of token to transfer |
| 210 | * @param bubble Behavior switch if the transfer call reverts: bubble the revert reason or return a false boolean. |
| 211 | */ |
| 212 | function _safeTransferFrom( |
| 213 | IERC20 token, |
| 214 | address from, |
| 215 | address to, |
| 216 | uint256 value, |
| 217 | bool bubble |
| 218 | ) private returns (bool success) { |
| 219 | bytes4 selector = IERC20.transferFrom.selector; |
| 220 | |
| 221 | assembly ("memory-safe") { |
| 222 | let fmp := mload(0x40) |
| 223 | mstore(0x00, selector) |
| 224 | mstore(0x04, and(from, shr(96, not(0)))) |
| 225 | mstore(0x24, and(to, shr(96, not(0)))) |
| 226 | mstore(0x44, value) |
| 227 | success := call(gas(), token, 0, 0x00, 0x64, 0x00, 0x20) |
| 228 | // if call success and return is true, all is good. |
| 229 | // otherwise (not success or return is not true), we need to perform further checks |
| 230 | if iszero(and(success, eq(mload(0x00), 1))) { |
| 231 | // if the call was a failure and bubble is enabled, bubble the error |
| 232 | if and(iszero(success), bubble) { |
| 233 | returndatacopy(fmp, 0x00, returndatasize()) |
| 234 | revert(fmp, returndatasize()) |
| 235 | } |
| 236 | // if the return value is not true, then the call is only successful if: |
| 237 | // - the token address has code |
| 238 | // - the returndata is empty |
| 239 | success := and(success, and(iszero(returndatasize()), gt(extcodesize(token), 0))) |
| 240 | } |
| 241 | mstore(0x40, fmp) |
| 242 | mstore(0x60, 0) |
| 243 | } |
| 244 | } |
| 245 | |
| 246 | /** |
| 247 | * @dev Imitates a Solidity `token.approve(spender, value)` call, relaxing the requirement on the return value: |
| 248 | * the return value is optional (but if data is returned, it must not be false). |
| 249 | * |
| 250 | * @param token The token targeted by the call. |
| 251 | * @param spender The spender of the tokens |
| 252 | * @param value The amount of token to transfer |
| 253 | * @param bubble Behavior switch if the transfer call reverts: bubble the revert reason or return a false boolean. |
| 254 | */ |
| 255 | function _safeApprove(IERC20 token, address spender, uint256 value, bool bubble) private returns (bool success) { |
| 256 | bytes4 selector = IERC20.approve.selector; |
| 257 | |
| 258 | assembly ("memory-safe") { |
| 259 | let fmp := mload(0x40) |
| 260 | mstore(0x00, selector) |
| 261 | mstore(0x04, and(spender, shr(96, not(0)))) |
| 262 | mstore(0x24, value) |
| 263 | success := call(gas(), token, 0, 0x00, 0x44, 0x00, 0x20) |
| 264 | // if call success and return is true, all is good. |
| 265 | // otherwise (not success or return is not true), we need to perform further checks |
| 266 | if iszero(and(success, eq(mload(0x00), 1))) { |
| 267 | // if the call was a failure and bubble is enabled, bubble the error |
| 268 | if and(iszero(success), bubble) { |
| 269 | returndatacopy(fmp, 0x00, returndatasize()) |
| 270 | revert(fmp, returndatasize()) |
| 271 | } |
| 272 | // if the return value is not true, then the call is only successful if: |
| 273 | // - the token address has code |
| 274 | // - the returndata is empty |
| 275 | success := and(success, and(iszero(returndatasize()), gt(extcodesize(token), 0))) |
| 276 | } |
| 277 | mstore(0x40, fmp) |
| 278 | } |
| 279 | } |
| 280 | } |
| 281 |
0.0%
lib/openzeppelin-contracts/contracts/utils/introspection/IERC165.sol
Lines covered: 0 / 0 (0.0%)
| 1 | // SPDX-License-Identifier: MIT |
| 2 | // OpenZeppelin Contracts (last updated v5.4.0) (utils/introspection/IERC165.sol) |
| 3 | |
| 4 | pragma solidity >=0.4.16; |
| 5 | |
| 6 | /** |
| 7 | * @dev Interface of the ERC-165 standard, as defined in the |
| 8 | * https://eips.ethereum.org/EIPS/eip-165[ERC]. |
| 9 | * |
| 10 | * Implementers can declare support of contract interfaces, which can then be |
| 11 | * queried by others ({ERC165Checker}). |
| 12 | * |
| 13 | * For an implementation, see {ERC165}. |
| 14 | */ |
| 15 | interface IERC165 { |
| 16 | /** |
| 17 | * @dev Returns true if this contract implements the interface defined by |
| 18 | * `interfaceId`. See the corresponding |
| 19 | * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section] |
| 20 | * to learn more about how these ids are created. |
| 21 | * |
| 22 | * This function call must use less than 30 000 gas. |
| 23 | */ |
| 24 | function supportsInterface(bytes4 interfaceId) external view returns (bool); |
| 25 | } |
| 26 |
18.0%
lib/solady/src/auth/Ownable.sol
Lines covered: 3 / 16 (18.0%)
| 1 | // SPDX-License-Identifier: MIT |
| 2 | pragma solidity ^0.8.4; |
| 3 | |
| 4 | /// @notice Simple single owner authorization mixin. |
| 5 | /// @author Solady (https://github.com/vectorized/solady/blob/main/src/auth/Ownable.sol) |
| 6 | /// |
| 7 | /// @dev Note: |
| 8 | /// This implementation does NOT auto-initialize the owner to `msg.sender`. |
| 9 | /// You MUST call the `_initializeOwner` in the constructor / initializer. |
| 10 | /// |
| 11 | /// While the ownable portion follows |
| 12 | /// [EIP-173](https://eips.ethereum.org/EIPS/eip-173) for compatibility, |
| 13 | /// the nomenclature for the 2-step ownership handover may be unique to this codebase. |
| 14 | abstract contract Ownable { |
| 15 | /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ |
| 16 | /* CUSTOM ERRORS */ |
| 17 | /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ |
| 18 | |
| 19 | /// @dev The caller is not authorized to call the function. |
| 20 | error Unauthorized(); |
| 21 | |
| 22 | /// @dev The `newOwner` cannot be the zero address. |
| 23 | error NewOwnerIsZeroAddress(); |
| 24 | |
| 25 | /// @dev The `pendingOwner` does not have a valid handover request. |
| 26 | error NoHandoverRequest(); |
| 27 | |
| 28 | /// @dev Cannot double-initialize. |
| 29 | error AlreadyInitialized(); |
| 30 | |
| 31 | /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ |
| 32 | /* EVENTS */ |
| 33 | /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ |
| 34 | |
| 35 | /// @dev The ownership is transferred from `oldOwner` to `newOwner`. |
| 36 | /// This event is intentionally kept the same as OpenZeppelin's Ownable to be |
| 37 | /// compatible with indexers and [EIP-173](https://eips.ethereum.org/EIPS/eip-173), |
| 38 | /// despite it not being as lightweight as a single argument event. |
| 39 | event OwnershipTransferred(address indexed oldOwner, address indexed newOwner); |
| 40 | |
| 41 | /// @dev An ownership handover to `pendingOwner` has been requested. |
| 42 | event OwnershipHandoverRequested(address indexed pendingOwner); |
| 43 | |
| 44 | /// @dev The ownership handover to `pendingOwner` has been canceled. |
| 45 | event OwnershipHandoverCanceled(address indexed pendingOwner); |
| 46 | |
| 47 | /// @dev `keccak256(bytes("OwnershipTransferred(address,address)"))`. |
| 48 | uint256 private constant _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE = |
| 49 | 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0; |
| 50 | |
| 51 | /// @dev `keccak256(bytes("OwnershipHandoverRequested(address)"))`. |
| 52 | uint256 private constant _OWNERSHIP_HANDOVER_REQUESTED_EVENT_SIGNATURE = |
| 53 | 0xdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d; |
| 54 | |
| 55 | /// @dev `keccak256(bytes("OwnershipHandoverCanceled(address)"))`. |
| 56 | uint256 private constant _OWNERSHIP_HANDOVER_CANCELED_EVENT_SIGNATURE = |
| 57 | 0xfa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92; |
| 58 | |
| 59 | /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ |
| 60 | /* STORAGE */ |
| 61 | /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ |
| 62 | |
| 63 | /// @dev The owner slot is given by: |
| 64 | /// `bytes32(~uint256(uint32(bytes4(keccak256("_OWNER_SLOT_NOT")))))`. |
| 65 | /// It is intentionally chosen to be a high value |
| 66 | /// to avoid collision with lower slots. |
| 67 | /// The choice of manual storage layout is to enable compatibility |
| 68 | /// with both regular and upgradeable contracts. |
| 69 | bytes32 internal constant _OWNER_SLOT = |
| 70 | 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffff74873927; |
| 71 | |
| 72 | /// The ownership handover slot of `newOwner` is given by: |
| 73 | /// ``` |
| 74 | /// mstore(0x00, or(shl(96, user), _HANDOVER_SLOT_SEED)) |
| 75 | /// let handoverSlot := keccak256(0x00, 0x20) |
| 76 | /// ``` |
| 77 | /// It stores the expiry timestamp of the two-step ownership handover. |
| 78 | uint256 private constant _HANDOVER_SLOT_SEED = 0x389a75e1; |
| 79 | |
| 80 | /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ |
| 81 | /* INTERNAL FUNCTIONS */ |
| 82 | /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ |
| 83 | |
| 84 | /// @dev Override to return true to make `_initializeOwner` prevent double-initialization. |
| 85 | function _guardInitializeOwner() internal pure virtual returns (bool guard) {} |
| 86 | |
| 87 | /// @dev Initializes the owner directly without authorization guard. |
| 88 | /// This function must be called upon initialization, |
| 89 | /// regardless of whether the contract is upgradeable or not. |
| 90 | /// This is to enable generalization to both regular and upgradeable contracts, |
| 91 | /// and to save gas in case the initial owner is not the caller. |
| 92 | /// For performance reasons, this function will not check if there |
| 93 | /// is an existing owner. |
| 94 | function _initializeOwner(address newOwner) internal virtual { |
| 95 | if (_guardInitializeOwner()) { |
| 96 | /// @solidity memory-safe-assembly |
| 97 | assembly { |
| 98 | let ownerSlot := _OWNER_SLOT |
| 99 | if sload(ownerSlot) { |
| 100 | mstore(0x00, 0x0dc149f0) // `AlreadyInitialized()`. |
| 101 | revert(0x1c, 0x04) |
| 102 | } |
| 103 | // Clean the upper 96 bits. |
| 104 | newOwner := shr(96, shl(96, newOwner)) |
| 105 | // Store the new value. |
| 106 | sstore(ownerSlot, or(newOwner, shl(255, iszero(newOwner)))) |
| 107 | // Emit the {OwnershipTransferred} event. |
| 108 | log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, 0, newOwner) |
| 109 | } |
| 110 | } else { |
| 111 | /// @solidity memory-safe-assembly |
| 112 | assembly { |
| 113 | // Clean the upper 96 bits. |
| 114 | newOwner := shr(96, shl(96, newOwner)) |
| 115 | // Store the new value. |
| 116 | sstore(_OWNER_SLOT, newOwner) |
| 117 | // Emit the {OwnershipTransferred} event. |
| 118 | log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, 0, newOwner) |
| 119 | } |
| 120 | } |
| 121 | } |
| 122 | |
| 123 | /// @dev Sets the owner directly without authorization guard. |
| 124 | function _setOwner(address newOwner) internal virtual { |
| 125 | if (_guardInitializeOwner()) { |
| 126 | /// @solidity memory-safe-assembly |
| 127 | assembly { |
| 128 | let ownerSlot := _OWNER_SLOT |
| 129 | // Clean the upper 96 bits. |
| 130 | newOwner := shr(96, shl(96, newOwner)) |
| 131 | // Emit the {OwnershipTransferred} event. |
| 132 | log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, sload(ownerSlot), newOwner) |
| 133 | // Store the new value. |
| 134 | sstore(ownerSlot, or(newOwner, shl(255, iszero(newOwner)))) |
| 135 | } |
| 136 | } else { |
| 137 | /// @solidity memory-safe-assembly |
| 138 | assembly { |
| 139 | let ownerSlot := _OWNER_SLOT |
| 140 | // Clean the upper 96 bits. |
| 141 | newOwner := shr(96, shl(96, newOwner)) |
| 142 | // Emit the {OwnershipTransferred} event. |
| 143 | log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, sload(ownerSlot), newOwner) |
| 144 | // Store the new value. |
| 145 | sstore(ownerSlot, newOwner) |
| 146 | } |
| 147 | } |
| 148 | } |
| 149 | |
| 150 | /// @dev Throws if the sender is not the owner. |
| 151 | function _checkOwner() internal view virtual { |
| 152 | /// @solidity memory-safe-assembly |
| 153 | assembly { |
| 154 | // If the caller is not the stored owner, revert. |
| 155 | if iszero(eq(caller(), sload(_OWNER_SLOT))) { |
| 156 | mstore(0x00, 0x82b42900) // `Unauthorized()`. |
| 157 | revert(0x1c, 0x04) |
| 158 | } |
| 159 | } |
| 160 | } |
| 161 | |
| 162 | /// @dev Returns how long a two-step ownership handover is valid for in seconds. |
| 163 | /// Override to return a different value if needed. |
| 164 | /// Made internal to conserve bytecode. Wrap it in a public function if needed. |
| 165 | function _ownershipHandoverValidFor() internal view virtual returns (uint64) { |
| 166 | return 48 * 3600; |
| 167 | } |
| 168 | |
| 169 | /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ |
| 170 | /* PUBLIC UPDATE FUNCTIONS */ |
| 171 | /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ |
| 172 | |
| 173 | /// @dev Allows the owner to transfer the ownership to `newOwner`. |
| 174 | function transferOwnership(address newOwner) public payable virtual onlyOwner { |
| 175 | /// @solidity memory-safe-assembly |
| 176 | assembly { |
| 177 | if iszero(shl(96, newOwner)) { |
| 178 | mstore(0x00, 0x7448fbae) // `NewOwnerIsZeroAddress()`. |
| 179 | revert(0x1c, 0x04) |
| 180 | } |
| 181 | } |
| 182 | _setOwner(newOwner); |
| 183 | } |
| 184 | |
| 185 | /// @dev Allows the owner to renounce their ownership. |
| 186 | function renounceOwnership() public payable virtual onlyOwner { |
| 187 | _setOwner(address(0)); |
| 188 | } |
| 189 | |
| 190 | /// @dev Request a two-step ownership handover to the caller. |
| 191 | /// The request will automatically expire in 48 hours (172800 seconds) by default. |
| 192 | function requestOwnershipHandover() public payable virtual { |
| 193 | unchecked { |
| 194 | uint256 expires = block.timestamp + _ownershipHandoverValidFor(); |
| 195 | /// @solidity memory-safe-assembly |
| 196 | assembly { |
| 197 | // Compute and set the handover slot to `expires`. |
| 198 | mstore(0x0c, _HANDOVER_SLOT_SEED) |
| 199 | mstore(0x00, caller()) |
| 200 | sstore(keccak256(0x0c, 0x20), expires) |
| 201 | // Emit the {OwnershipHandoverRequested} event. |
| 202 | log2(0, 0, _OWNERSHIP_HANDOVER_REQUESTED_EVENT_SIGNATURE, caller()) |
| 203 | } |
| 204 | } |
| 205 | } |
| 206 | |
| 207 | /// @dev Cancels the two-step ownership handover to the caller, if any. |
| 208 | function cancelOwnershipHandover() public payable virtual { |
| 209 | /// @solidity memory-safe-assembly |
| 210 | assembly { |
| 211 | // Compute and set the handover slot to 0. |
| 212 | mstore(0x0c, _HANDOVER_SLOT_SEED) |
| 213 | mstore(0x00, caller()) |
| 214 | sstore(keccak256(0x0c, 0x20), 0) |
| 215 | // Emit the {OwnershipHandoverCanceled} event. |
| 216 | log2(0, 0, _OWNERSHIP_HANDOVER_CANCELED_EVENT_SIGNATURE, caller()) |
| 217 | } |
| 218 | } |
| 219 | |
| 220 | /// @dev Allows the owner to complete the two-step ownership handover to `pendingOwner`. |
| 221 | /// Reverts if there is no existing ownership handover requested by `pendingOwner`. |
| 222 | function completeOwnershipHandover(address pendingOwner) public payable virtual onlyOwner { |
| 223 | /// @solidity memory-safe-assembly |
| 224 | assembly { |
| 225 | // Compute and set the handover slot to 0. |
| 226 | mstore(0x0c, _HANDOVER_SLOT_SEED) |
| 227 | mstore(0x00, pendingOwner) |
| 228 | let handoverSlot := keccak256(0x0c, 0x20) |
| 229 | // If the handover does not exist, or has expired. |
| 230 | if gt(timestamp(), sload(handoverSlot)) { |
| 231 | mstore(0x00, 0x6f5e8818) // `NoHandoverRequest()`. |
| 232 | revert(0x1c, 0x04) |
| 233 | } |
| 234 | // Set the handover slot to 0. |
| 235 | sstore(handoverSlot, 0) |
| 236 | } |
| 237 | _setOwner(pendingOwner); |
| 238 | } |
| 239 | |
| 240 | /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ |
| 241 | /* PUBLIC READ FUNCTIONS */ |
| 242 | /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ |
| 243 | |
| 244 | /// @dev Returns the owner of the contract. |
| 245 | function owner() public view virtual returns (address result) { |
| 246 | /// @solidity memory-safe-assembly |
| 247 | assembly { |
| 248 | result := sload(_OWNER_SLOT) |
| 249 | } |
| 250 | } |
| 251 | |
| 252 | /// @dev Returns the expiry timestamp for the two-step ownership handover to `pendingOwner`. |
| 253 | function ownershipHandoverExpiresAt(address pendingOwner) |
| 254 | public |
| 255 | view |
| 256 | virtual |
| 257 | returns (uint256 result) |
| 258 | { |
| 259 | /// @solidity memory-safe-assembly |
| 260 | assembly { |
| 261 | // Compute the handover slot. |
| 262 | mstore(0x0c, _HANDOVER_SLOT_SEED) |
| 263 | mstore(0x00, pendingOwner) |
| 264 | // Load the handover slot. |
| 265 | result := sload(keccak256(0x0c, 0x20)) |
| 266 | } |
| 267 | } |
| 268 | |
| 269 | /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ |
| 270 | /* MODIFIERS */ |
| 271 | /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ |
| 272 | |
| 273 | /// @dev Marks a function as only callable by the owner. |
| 274 | modifier onlyOwner() virtual { |
| 275 | _checkOwner(); |
| 276 | _; |
| 277 | } |
| 278 | } |
| 279 |
31.0%
lib/solady/src/tokens/ERC20.sol
Lines covered: 6 / 19 (31.0%)
| 1 | // SPDX-License-Identifier: MIT |
| 2 | pragma solidity ^0.8.4; |
| 3 | |
| 4 | /// @notice Simple ERC20 + EIP-2612 implementation. |
| 5 | /// @author Solady (https://github.com/vectorized/solady/blob/main/src/tokens/ERC20.sol) |
| 6 | /// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC20.sol) |
| 7 | /// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol) |
| 8 | /// |
| 9 | /// @dev Note: |
| 10 | /// - The ERC20 standard allows minting and transferring to and from the zero address, |
| 11 | /// minting and transferring zero tokens, as well as self-approvals. |
| 12 | /// For performance, this implementation WILL NOT revert for such actions. |
| 13 | /// Please add any checks with overrides if desired. |
| 14 | /// - The `permit` function uses the ecrecover precompile (0x1). |
| 15 | /// |
| 16 | /// If you are overriding: |
| 17 | /// - NEVER violate the ERC20 invariant: |
| 18 | /// the total sum of all balances must be equal to `totalSupply()`. |
| 19 | /// - Check that the overridden function is actually used in the function you want to |
| 20 | /// change the behavior of. Much of the code has been manually inlined for performance. |
| 21 | abstract contract ERC20 { |
| 22 | /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ |
| 23 | /* CUSTOM ERRORS */ |
| 24 | /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ |
| 25 | |
| 26 | /// @dev The total supply has overflowed. |
| 27 | error TotalSupplyOverflow(); |
| 28 | |
| 29 | /// @dev The allowance has overflowed. |
| 30 | error AllowanceOverflow(); |
| 31 | |
| 32 | /// @dev The allowance has underflowed. |
| 33 | error AllowanceUnderflow(); |
| 34 | |
| 35 | /// @dev Insufficient balance. |
| 36 | error InsufficientBalance(); |
| 37 | |
| 38 | /// @dev Insufficient allowance. |
| 39 | error InsufficientAllowance(); |
| 40 | |
| 41 | /// @dev The permit is invalid. |
| 42 | error InvalidPermit(); |
| 43 | |
| 44 | /// @dev The permit has expired. |
| 45 | error PermitExpired(); |
| 46 | |
| 47 | /// @dev The allowance of Permit2 is fixed at infinity. |
| 48 | error Permit2AllowanceIsFixedAtInfinity(); |
| 49 | |
| 50 | /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ |
| 51 | /* EVENTS */ |
| 52 | /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ |
| 53 | |
| 54 | /// @dev Emitted when `amount` tokens is transferred from `from` to `to`. |
| 55 | event Transfer(address indexed from, address indexed to, uint256 amount); |
| 56 | |
| 57 | /// @dev Emitted when `amount` tokens is approved by `owner` to be used by `spender`. |
| 58 | event Approval(address indexed owner, address indexed spender, uint256 amount); |
| 59 | |
| 60 | /// @dev `keccak256(bytes("Transfer(address,address,uint256)"))`. |
| 61 | uint256 private constant _TRANSFER_EVENT_SIGNATURE = |
| 62 | 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef; |
| 63 | |
| 64 | /// @dev `keccak256(bytes("Approval(address,address,uint256)"))`. |
| 65 | uint256 private constant _APPROVAL_EVENT_SIGNATURE = |
| 66 | 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925; |
| 67 | |
| 68 | /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ |
| 69 | /* STORAGE */ |
| 70 | /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ |
| 71 | |
| 72 | /// @dev The storage slot for the total supply. |
| 73 | uint256 private constant _TOTAL_SUPPLY_SLOT = 0x05345cdf77eb68f44c; |
| 74 | |
| 75 | /// @dev The balance slot of `owner` is given by: |
| 76 | /// ``` |
| 77 | /// mstore(0x0c, _BALANCE_SLOT_SEED) |
| 78 | /// mstore(0x00, owner) |
| 79 | /// let balanceSlot := keccak256(0x0c, 0x20) |
| 80 | /// ``` |
| 81 | uint256 private constant _BALANCE_SLOT_SEED = 0x87a211a2; |
| 82 | |
| 83 | /// @dev The allowance slot of (`owner`, `spender`) is given by: |
| 84 | /// ``` |
| 85 | /// mstore(0x20, spender) |
| 86 | /// mstore(0x0c, _ALLOWANCE_SLOT_SEED) |
| 87 | /// mstore(0x00, owner) |
| 88 | /// let allowanceSlot := keccak256(0x0c, 0x34) |
| 89 | /// ``` |
| 90 | uint256 private constant _ALLOWANCE_SLOT_SEED = 0x7f5e9f20; |
| 91 | |
| 92 | /// @dev The nonce slot of `owner` is given by: |
| 93 | /// ``` |
| 94 | /// mstore(0x0c, _NONCES_SLOT_SEED) |
| 95 | /// mstore(0x00, owner) |
| 96 | /// let nonceSlot := keccak256(0x0c, 0x20) |
| 97 | /// ``` |
| 98 | uint256 private constant _NONCES_SLOT_SEED = 0x38377508; |
| 99 | |
| 100 | /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ |
| 101 | /* CONSTANTS */ |
| 102 | /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ |
| 103 | |
| 104 | /// @dev `(_NONCES_SLOT_SEED << 16) | 0x1901`. |
| 105 | uint256 private constant _NONCES_SLOT_SEED_WITH_SIGNATURE_PREFIX = 0x383775081901; |
| 106 | |
| 107 | /// @dev `keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)")`. |
| 108 | bytes32 private constant _DOMAIN_TYPEHASH = |
| 109 | 0x8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f; |
| 110 | |
| 111 | /// @dev `keccak256("1")`. |
| 112 | /// If you need to use a different version, override `_versionHash`. |
| 113 | bytes32 private constant _DEFAULT_VERSION_HASH = |
| 114 | 0xc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6; |
| 115 | |
| 116 | /// @dev `keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)")`. |
| 117 | bytes32 private constant _PERMIT_TYPEHASH = |
| 118 | 0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9; |
| 119 | |
| 120 | /// @dev The canonical Permit2 address. |
| 121 | /// For signature-based allowance granting for single transaction ERC20 `transferFrom`. |
| 122 | /// Enabled by default. To disable, override `_givePermit2InfiniteAllowance()`. |
| 123 | /// [Github](https://github.com/Uniswap/permit2) |
| 124 | /// [Etherscan](https://etherscan.io/address/0x000000000022D473030F116dDEE9F6B43aC78BA3) |
| 125 | address internal constant _PERMIT2 = 0x000000000022D473030F116dDEE9F6B43aC78BA3; |
| 126 | |
| 127 | /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ |
| 128 | /* ERC20 METADATA */ |
| 129 | /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ |
| 130 | |
| 131 | /// @dev Returns the name of the token. |
| 132 | function name() public view virtual returns (string memory); |
| 133 | |
| 134 | /// @dev Returns the symbol of the token. |
| 135 | function symbol() public view virtual returns (string memory); |
| 136 | |
| 137 | /// @dev Returns the decimals places of the token. |
| 138 | function decimals() public view virtual returns (uint8) { |
| 139 | return 18; |
| 140 | } |
| 141 | |
| 142 | /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ |
| 143 | /* ERC20 */ |
| 144 | /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ |
| 145 | |
| 146 | /// @dev Returns the amount of tokens in existence. |
| 147 | function totalSupply() public view virtual returns (uint256 result) { |
| 148 | /// @solidity memory-safe-assembly |
| 149 | assembly { |
| 150 | result := sload(_TOTAL_SUPPLY_SLOT) |
| 151 | } |
| 152 | } |
| 153 | |
| 154 | /// @dev Returns the amount of tokens owned by `owner`. |
| 155 | function balanceOf(address owner) public view virtual returns (uint256 result) { |
| 156 | /// @solidity memory-safe-assembly |
| 157 | assembly { |
| 158 | mstore(0x0c, _BALANCE_SLOT_SEED) |
| 159 | mstore(0x00, owner) |
| 160 | result := sload(keccak256(0x0c, 0x20)) |
| 161 | } |
| 162 | } |
| 163 | |
| 164 | /// @dev Returns the amount of tokens that `spender` can spend on behalf of `owner`. |
| 165 | function allowance(address owner, address spender) |
| 166 | public |
| 167 | view |
| 168 | virtual |
| 169 | returns (uint256 result) |
| 170 | { |
| 171 | if (_givePermit2InfiniteAllowance()) { |
| 172 | if (spender == _PERMIT2) return type(uint256).max; |
| 173 | } |
| 174 | /// @solidity memory-safe-assembly |
| 175 | assembly { |
| 176 | mstore(0x20, spender) |
| 177 | mstore(0x0c, _ALLOWANCE_SLOT_SEED) |
| 178 | mstore(0x00, owner) |
| 179 | result := sload(keccak256(0x0c, 0x34)) |
| 180 | } |
| 181 | } |
| 182 | |
| 183 | /// @dev Sets `amount` as the allowance of `spender` over the caller's tokens. |
| 184 | /// |
| 185 | /// Emits a {Approval} event. |
| 186 | function approve(address spender, uint256 amount) public virtual returns (bool) { |
| 187 | if (_givePermit2InfiniteAllowance()) { |
| 188 | /// @solidity memory-safe-assembly |
| 189 | assembly { |
| 190 | // If `spender == _PERMIT2 && amount != type(uint256).max`. |
| 191 | if iszero(or(xor(shr(96, shl(96, spender)), _PERMIT2), iszero(not(amount)))) { |
| 192 | mstore(0x00, 0x3f68539a) // `Permit2AllowanceIsFixedAtInfinity()`. |
| 193 | revert(0x1c, 0x04) |
| 194 | } |
| 195 | } |
| 196 | } |
| 197 | /// @solidity memory-safe-assembly |
| 198 | assembly { |
| 199 | // Compute the allowance slot and store the amount. |
| 200 | mstore(0x20, spender) |
| 201 | mstore(0x0c, _ALLOWANCE_SLOT_SEED) |
| 202 | mstore(0x00, caller()) |
| 203 | sstore(keccak256(0x0c, 0x34), amount) |
| 204 | // Emit the {Approval} event. |
| 205 | mstore(0x00, amount) |
| 206 | log3(0x00, 0x20, _APPROVAL_EVENT_SIGNATURE, caller(), shr(96, mload(0x2c))) |
| 207 | } |
| 208 | return true; |
| 209 | } |
| 210 | |
| 211 | /// @dev Transfer `amount` tokens from the caller to `to`. |
| 212 | /// |
| 213 | /// Requirements: |
| 214 | /// - `from` must at least have `amount`. |
| 215 | /// |
| 216 | /// Emits a {Transfer} event. |
| 217 | function transfer(address to, uint256 amount) public virtual returns (bool) { |
| 218 | _beforeTokenTransfer(msg.sender, to, amount); |
| 219 | /// @solidity memory-safe-assembly |
| 220 | assembly { |
| 221 | // Compute the balance slot and load its value. |
| 222 | mstore(0x0c, _BALANCE_SLOT_SEED) |
| 223 | mstore(0x00, caller()) |
| 224 | let fromBalanceSlot := keccak256(0x0c, 0x20) |
| 225 | let fromBalance := sload(fromBalanceSlot) |
| 226 | // Revert if insufficient balance. |
| 227 | if gt(amount, fromBalance) { |
| 228 | mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`. |
| 229 | revert(0x1c, 0x04) |
| 230 | } |
| 231 | // Subtract and store the updated balance. |
| 232 | sstore(fromBalanceSlot, sub(fromBalance, amount)) |
| 233 | // Compute the balance slot of `to`. |
| 234 | mstore(0x00, to) |
| 235 | let toBalanceSlot := keccak256(0x0c, 0x20) |
| 236 | // Add and store the updated balance of `to`. |
| 237 | // Will not overflow because the sum of all user balances |
| 238 | // cannot exceed the maximum uint256 value. |
| 239 | sstore(toBalanceSlot, add(sload(toBalanceSlot), amount)) |
| 240 | // Emit the {Transfer} event. |
| 241 | mstore(0x20, amount) |
| 242 | log3(0x20, 0x20, _TRANSFER_EVENT_SIGNATURE, caller(), shr(96, mload(0x0c))) |
| 243 | } |
| 244 | _afterTokenTransfer(msg.sender, to, amount); |
| 245 | return true; |
| 246 | } |
| 247 | |
| 248 | /// @dev Transfers `amount` tokens from `from` to `to`. |
| 249 | /// |
| 250 | /// Note: Does not update the allowance if it is the maximum uint256 value. |
| 251 | /// |
| 252 | /// Requirements: |
| 253 | /// - `from` must at least have `amount`. |
| 254 | /// - The caller must have at least `amount` of allowance to transfer the tokens of `from`. |
| 255 | /// |
| 256 | /// Emits a {Transfer} event. |
| 257 | function transferFrom(address from, address to, uint256 amount) public virtual returns (bool) { |
| 258 | _beforeTokenTransfer(from, to, amount); |
| 259 | // Code duplication is for zero-cost abstraction if possible. |
| 260 | if (_givePermit2InfiniteAllowance()) { |
| 261 | /// @solidity memory-safe-assembly |
| 262 | assembly { |
| 263 | let from_ := shl(96, from) |
| 264 | if iszero(eq(caller(), _PERMIT2)) { |
| 265 | // Compute the allowance slot and load its value. |
| 266 | mstore(0x20, caller()) |
| 267 | mstore(0x0c, or(from_, _ALLOWANCE_SLOT_SEED)) |
| 268 | let allowanceSlot := keccak256(0x0c, 0x34) |
| 269 | let allowance_ := sload(allowanceSlot) |
| 270 | // If the allowance is not the maximum uint256 value. |
| 271 | if not(allowance_) { |
| 272 | // Revert if the amount to be transferred exceeds the allowance. |
| 273 | if gt(amount, allowance_) { |
| 274 | mstore(0x00, 0x13be252b) // `InsufficientAllowance()`. |
| 275 | revert(0x1c, 0x04) |
| 276 | } |
| 277 | // Subtract and store the updated allowance. |
| 278 | sstore(allowanceSlot, sub(allowance_, amount)) |
| 279 | } |
| 280 | } |
| 281 | // Compute the balance slot and load its value. |
| 282 | mstore(0x0c, or(from_, _BALANCE_SLOT_SEED)) |
| 283 | let fromBalanceSlot := keccak256(0x0c, 0x20) |
| 284 | let fromBalance := sload(fromBalanceSlot) |
| 285 | // Revert if insufficient balance. |
| 286 | if gt(amount, fromBalance) { |
| 287 | mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`. |
| 288 | revert(0x1c, 0x04) |
| 289 | } |
| 290 | // Subtract and store the updated balance. |
| 291 | sstore(fromBalanceSlot, sub(fromBalance, amount)) |
| 292 | // Compute the balance slot of `to`. |
| 293 | mstore(0x00, to) |
| 294 | let toBalanceSlot := keccak256(0x0c, 0x20) |
| 295 | // Add and store the updated balance of `to`. |
| 296 | // Will not overflow because the sum of all user balances |
| 297 | // cannot exceed the maximum uint256 value. |
| 298 | sstore(toBalanceSlot, add(sload(toBalanceSlot), amount)) |
| 299 | // Emit the {Transfer} event. |
| 300 | mstore(0x20, amount) |
| 301 | log3(0x20, 0x20, _TRANSFER_EVENT_SIGNATURE, shr(96, from_), shr(96, mload(0x0c))) |
| 302 | } |
| 303 | } else { |
| 304 | /// @solidity memory-safe-assembly |
| 305 | assembly { |
| 306 | let from_ := shl(96, from) |
| 307 | // Compute the allowance slot and load its value. |
| 308 | mstore(0x20, caller()) |
| 309 | mstore(0x0c, or(from_, _ALLOWANCE_SLOT_SEED)) |
| 310 | let allowanceSlot := keccak256(0x0c, 0x34) |
| 311 | let allowance_ := sload(allowanceSlot) |
| 312 | // If the allowance is not the maximum uint256 value. |
| 313 | if not(allowance_) { |
| 314 | // Revert if the amount to be transferred exceeds the allowance. |
| 315 | if gt(amount, allowance_) { |
| 316 | mstore(0x00, 0x13be252b) // `InsufficientAllowance()`. |
| 317 | revert(0x1c, 0x04) |
| 318 | } |
| 319 | // Subtract and store the updated allowance. |
| 320 | sstore(allowanceSlot, sub(allowance_, amount)) |
| 321 | } |
| 322 | // Compute the balance slot and load its value. |
| 323 | mstore(0x0c, or(from_, _BALANCE_SLOT_SEED)) |
| 324 | let fromBalanceSlot := keccak256(0x0c, 0x20) |
| 325 | let fromBalance := sload(fromBalanceSlot) |
| 326 | // Revert if insufficient balance. |
| 327 | if gt(amount, fromBalance) { |
| 328 | mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`. |
| 329 | revert(0x1c, 0x04) |
| 330 | } |
| 331 | // Subtract and store the updated balance. |
| 332 | sstore(fromBalanceSlot, sub(fromBalance, amount)) |
| 333 | // Compute the balance slot of `to`. |
| 334 | mstore(0x00, to) |
| 335 | let toBalanceSlot := keccak256(0x0c, 0x20) |
| 336 | // Add and store the updated balance of `to`. |
| 337 | // Will not overflow because the sum of all user balances |
| 338 | // cannot exceed the maximum uint256 value. |
| 339 | sstore(toBalanceSlot, add(sload(toBalanceSlot), amount)) |
| 340 | // Emit the {Transfer} event. |
| 341 | mstore(0x20, amount) |
| 342 | log3(0x20, 0x20, _TRANSFER_EVENT_SIGNATURE, shr(96, from_), shr(96, mload(0x0c))) |
| 343 | } |
| 344 | } |
| 345 | _afterTokenTransfer(from, to, amount); |
| 346 | return true; |
| 347 | } |
| 348 | |
| 349 | /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ |
| 350 | /* EIP-2612 */ |
| 351 | /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ |
| 352 | |
| 353 | /// @dev For more performance, override to return the constant value |
| 354 | /// of `keccak256(bytes(name()))` if `name()` will never change. |
| 355 | function _constantNameHash() internal view virtual returns (bytes32 result) {} |
| 356 | |
| 357 | /// @dev If you need a different value, override this function. |
| 358 | function _versionHash() internal view virtual returns (bytes32 result) { |
| 359 | result = _DEFAULT_VERSION_HASH; |
| 360 | } |
| 361 | |
| 362 | /// @dev For inheriting contracts to increment the nonce. |
| 363 | function _incrementNonce(address owner) internal virtual { |
| 364 | /// @solidity memory-safe-assembly |
| 365 | assembly { |
| 366 | mstore(0x0c, _NONCES_SLOT_SEED) |
| 367 | mstore(0x00, owner) |
| 368 | let nonceSlot := keccak256(0x0c, 0x20) |
| 369 | sstore(nonceSlot, add(1, sload(nonceSlot))) |
| 370 | } |
| 371 | } |
| 372 | |
| 373 | /// @dev Returns the current nonce for `owner`. |
| 374 | /// This value is used to compute the signature for EIP-2612 permit. |
| 375 | function nonces(address owner) public view virtual returns (uint256 result) { |
| 376 | /// @solidity memory-safe-assembly |
| 377 | assembly { |
| 378 | // Compute the nonce slot and load its value. |
| 379 | mstore(0x0c, _NONCES_SLOT_SEED) |
| 380 | mstore(0x00, owner) |
| 381 | result := sload(keccak256(0x0c, 0x20)) |
| 382 | } |
| 383 | } |
| 384 | |
| 385 | /// @dev Sets `value` as the allowance of `spender` over the tokens of `owner`, |
| 386 | /// authorized by a signed approval by `owner`. |
| 387 | /// |
| 388 | /// Emits a {Approval} event. |
| 389 | function permit( |
| 390 | address owner, |
| 391 | address spender, |
| 392 | uint256 value, |
| 393 | uint256 deadline, |
| 394 | uint8 v, |
| 395 | bytes32 r, |
| 396 | bytes32 s |
| 397 | ) public virtual { |
| 398 | if (_givePermit2InfiniteAllowance()) { |
| 399 | /// @solidity memory-safe-assembly |
| 400 | assembly { |
| 401 | // If `spender == _PERMIT2 && value != type(uint256).max`. |
| 402 | if iszero(or(xor(shr(96, shl(96, spender)), _PERMIT2), iszero(not(value)))) { |
| 403 | mstore(0x00, 0x3f68539a) // `Permit2AllowanceIsFixedAtInfinity()`. |
| 404 | revert(0x1c, 0x04) |
| 405 | } |
| 406 | } |
| 407 | } |
| 408 | bytes32 nameHash = _constantNameHash(); |
| 409 | // We simply calculate it on-the-fly to allow for cases where the `name` may change. |
| 410 | if (nameHash == bytes32(0)) nameHash = keccak256(bytes(name())); |
| 411 | bytes32 versionHash = _versionHash(); |
| 412 | /// @solidity memory-safe-assembly |
| 413 | assembly { |
| 414 | // Revert if the block timestamp is greater than `deadline`. |
| 415 | if gt(timestamp(), deadline) { |
| 416 | mstore(0x00, 0x1a15a3cc) // `PermitExpired()`. |
| 417 | revert(0x1c, 0x04) |
| 418 | } |
| 419 | let m := mload(0x40) // Grab the free memory pointer. |
| 420 | // Clean the upper 96 bits. |
| 421 | owner := shr(96, shl(96, owner)) |
| 422 | spender := shr(96, shl(96, spender)) |
| 423 | // Compute the nonce slot and load its value. |
| 424 | mstore(0x0e, _NONCES_SLOT_SEED_WITH_SIGNATURE_PREFIX) |
| 425 | mstore(0x00, owner) |
| 426 | let nonceSlot := keccak256(0x0c, 0x20) |
| 427 | let nonceValue := sload(nonceSlot) |
| 428 | // Prepare the domain separator. |
| 429 | mstore(m, _DOMAIN_TYPEHASH) |
| 430 | mstore(add(m, 0x20), nameHash) |
| 431 | mstore(add(m, 0x40), versionHash) |
| 432 | mstore(add(m, 0x60), chainid()) |
| 433 | mstore(add(m, 0x80), address()) |
| 434 | mstore(0x2e, keccak256(m, 0xa0)) |
| 435 | // Prepare the struct hash. |
| 436 | mstore(m, _PERMIT_TYPEHASH) |
| 437 | mstore(add(m, 0x20), owner) |
| 438 | mstore(add(m, 0x40), spender) |
| 439 | mstore(add(m, 0x60), value) |
| 440 | mstore(add(m, 0x80), nonceValue) |
| 441 | mstore(add(m, 0xa0), deadline) |
| 442 | mstore(0x4e, keccak256(m, 0xc0)) |
| 443 | // Prepare the ecrecover calldata. |
| 444 | mstore(0x00, keccak256(0x2c, 0x42)) |
| 445 | mstore(0x20, and(0xff, v)) |
| 446 | mstore(0x40, r) |
| 447 | mstore(0x60, s) |
| 448 | let t := staticcall(gas(), 1, 0x00, 0x80, 0x20, 0x20) |
| 449 | // If the ecrecover fails, the returndatasize will be 0x00, |
| 450 | // `owner` will be checked if it equals the hash at 0x00, |
| 451 | // which evaluates to false (i.e. 0), and we will revert. |
| 452 | // If the ecrecover succeeds, the returndatasize will be 0x20, |
| 453 | // `owner` will be compared against the returned address at 0x20. |
| 454 | if iszero(eq(mload(returndatasize()), owner)) { |
| 455 | mstore(0x00, 0xddafbaef) // `InvalidPermit()`. |
| 456 | revert(0x1c, 0x04) |
| 457 | } |
| 458 | // Increment and store the updated nonce. |
| 459 | sstore(nonceSlot, add(nonceValue, t)) // `t` is 1 if ecrecover succeeds. |
| 460 | // Compute the allowance slot and store the value. |
| 461 | // The `owner` is already at slot 0x20. |
| 462 | mstore(0x40, or(shl(160, _ALLOWANCE_SLOT_SEED), spender)) |
| 463 | sstore(keccak256(0x2c, 0x34), value) |
| 464 | // Emit the {Approval} event. |
| 465 | log3(add(m, 0x60), 0x20, _APPROVAL_EVENT_SIGNATURE, owner, spender) |
| 466 | mstore(0x40, m) // Restore the free memory pointer. |
| 467 | mstore(0x60, 0) // Restore the zero pointer. |
| 468 | } |
| 469 | } |
| 470 | |
| 471 | /// @dev Returns the EIP-712 domain separator for the EIP-2612 permit. |
| 472 | function DOMAIN_SEPARATOR() public view virtual returns (bytes32 result) { |
| 473 | bytes32 nameHash = _constantNameHash(); |
| 474 | // We simply calculate it on-the-fly to allow for cases where the `name` may change. |
| 475 | if (nameHash == bytes32(0)) nameHash = keccak256(bytes(name())); |
| 476 | bytes32 versionHash = _versionHash(); |
| 477 | /// @solidity memory-safe-assembly |
| 478 | assembly { |
| 479 | let m := mload(0x40) // Grab the free memory pointer. |
| 480 | mstore(m, _DOMAIN_TYPEHASH) |
| 481 | mstore(add(m, 0x20), nameHash) |
| 482 | mstore(add(m, 0x40), versionHash) |
| 483 | mstore(add(m, 0x60), chainid()) |
| 484 | mstore(add(m, 0x80), address()) |
| 485 | result := keccak256(m, 0xa0) |
| 486 | } |
| 487 | } |
| 488 | |
| 489 | /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ |
| 490 | /* INTERNAL MINT FUNCTIONS */ |
| 491 | /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ |
| 492 | |
| 493 | /// @dev Mints `amount` tokens to `to`, increasing the total supply. |
| 494 | /// |
| 495 | /// Emits a {Transfer} event. |
| 496 | function _mint(address to, uint256 amount) internal virtual { |
| 497 | _beforeTokenTransfer(address(0), to, amount); |
| 498 | /// @solidity memory-safe-assembly |
| 499 | assembly { |
| 500 | let totalSupplyBefore := sload(_TOTAL_SUPPLY_SLOT) |
| 501 | let totalSupplyAfter := add(totalSupplyBefore, amount) |
| 502 | // Revert if the total supply overflows. |
| 503 | if lt(totalSupplyAfter, totalSupplyBefore) { |
| 504 | mstore(0x00, 0xe5cfe957) // `TotalSupplyOverflow()`. |
| 505 | revert(0x1c, 0x04) |
| 506 | } |
| 507 | // Store the updated total supply. |
| 508 | sstore(_TOTAL_SUPPLY_SLOT, totalSupplyAfter) |
| 509 | // Compute the balance slot and load its value. |
| 510 | mstore(0x0c, _BALANCE_SLOT_SEED) |
| 511 | mstore(0x00, to) |
| 512 | let toBalanceSlot := keccak256(0x0c, 0x20) |
| 513 | // Add and store the updated balance. |
| 514 | sstore(toBalanceSlot, add(sload(toBalanceSlot), amount)) |
| 515 | // Emit the {Transfer} event. |
| 516 | mstore(0x20, amount) |
| 517 | log3(0x20, 0x20, _TRANSFER_EVENT_SIGNATURE, 0, shr(96, mload(0x0c))) |
| 518 | } |
| 519 | _afterTokenTransfer(address(0), to, amount); |
| 520 | } |
| 521 | |
| 522 | /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ |
| 523 | /* INTERNAL BURN FUNCTIONS */ |
| 524 | /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ |
| 525 | |
| 526 | /// @dev Burns `amount` tokens from `from`, reducing the total supply. |
| 527 | /// |
| 528 | /// Emits a {Transfer} event. |
| 529 | function _burn(address from, uint256 amount) internal virtual { |
| 530 | _beforeTokenTransfer(from, address(0), amount); |
| 531 | /// @solidity memory-safe-assembly |
| 532 | assembly { |
| 533 | // Compute the balance slot and load its value. |
| 534 | mstore(0x0c, _BALANCE_SLOT_SEED) |
| 535 | mstore(0x00, from) |
| 536 | let fromBalanceSlot := keccak256(0x0c, 0x20) |
| 537 | let fromBalance := sload(fromBalanceSlot) |
| 538 | // Revert if insufficient balance. |
| 539 | if gt(amount, fromBalance) { |
| 540 | mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`. |
| 541 | revert(0x1c, 0x04) |
| 542 | } |
| 543 | // Subtract and store the updated balance. |
| 544 | sstore(fromBalanceSlot, sub(fromBalance, amount)) |
| 545 | // Subtract and store the updated total supply. |
| 546 | sstore(_TOTAL_SUPPLY_SLOT, sub(sload(_TOTAL_SUPPLY_SLOT), amount)) |
| 547 | // Emit the {Transfer} event. |
| 548 | mstore(0x00, amount) |
| 549 | log3(0x00, 0x20, _TRANSFER_EVENT_SIGNATURE, shr(96, shl(96, from)), 0) |
| 550 | } |
| 551 | _afterTokenTransfer(from, address(0), amount); |
| 552 | } |
| 553 | |
| 554 | /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ |
| 555 | /* INTERNAL TRANSFER FUNCTIONS */ |
| 556 | /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ |
| 557 | |
| 558 | /// @dev Moves `amount` of tokens from `from` to `to`. |
| 559 | function _transfer(address from, address to, uint256 amount) internal virtual { |
| 560 | _beforeTokenTransfer(from, to, amount); |
| 561 | /// @solidity memory-safe-assembly |
| 562 | assembly { |
| 563 | let from_ := shl(96, from) |
| 564 | // Compute the balance slot and load its value. |
| 565 | mstore(0x0c, or(from_, _BALANCE_SLOT_SEED)) |
| 566 | let fromBalanceSlot := keccak256(0x0c, 0x20) |
| 567 | let fromBalance := sload(fromBalanceSlot) |
| 568 | // Revert if insufficient balance. |
| 569 | if gt(amount, fromBalance) { |
| 570 | mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`. |
| 571 | revert(0x1c, 0x04) |
| 572 | } |
| 573 | // Subtract and store the updated balance. |
| 574 | sstore(fromBalanceSlot, sub(fromBalance, amount)) |
| 575 | // Compute the balance slot of `to`. |
| 576 | mstore(0x00, to) |
| 577 | let toBalanceSlot := keccak256(0x0c, 0x20) |
| 578 | // Add and store the updated balance of `to`. |
| 579 | // Will not overflow because the sum of all user balances |
| 580 | // cannot exceed the maximum uint256 value. |
| 581 | sstore(toBalanceSlot, add(sload(toBalanceSlot), amount)) |
| 582 | // Emit the {Transfer} event. |
| 583 | mstore(0x20, amount) |
| 584 | log3(0x20, 0x20, _TRANSFER_EVENT_SIGNATURE, shr(96, from_), shr(96, mload(0x0c))) |
| 585 | } |
| 586 | _afterTokenTransfer(from, to, amount); |
| 587 | } |
| 588 | |
| 589 | /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ |
| 590 | /* INTERNAL ALLOWANCE FUNCTIONS */ |
| 591 | /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ |
| 592 | |
| 593 | /// @dev Updates the allowance of `owner` for `spender` based on spent `amount`. |
| 594 | function _spendAllowance(address owner, address spender, uint256 amount) internal virtual { |
| 595 | if (_givePermit2InfiniteAllowance()) { |
| 596 | if (spender == _PERMIT2) return; // Do nothing, as allowance is infinite. |
| 597 | } |
| 598 | /// @solidity memory-safe-assembly |
| 599 | assembly { |
| 600 | // Compute the allowance slot and load its value. |
| 601 | mstore(0x20, spender) |
| 602 | mstore(0x0c, _ALLOWANCE_SLOT_SEED) |
| 603 | mstore(0x00, owner) |
| 604 | let allowanceSlot := keccak256(0x0c, 0x34) |
| 605 | let allowance_ := sload(allowanceSlot) |
| 606 | // If the allowance is not the maximum uint256 value. |
| 607 | if not(allowance_) { |
| 608 | // Revert if the amount to be transferred exceeds the allowance. |
| 609 | if gt(amount, allowance_) { |
| 610 | mstore(0x00, 0x13be252b) // `InsufficientAllowance()`. |
| 611 | revert(0x1c, 0x04) |
| 612 | } |
| 613 | // Subtract and store the updated allowance. |
| 614 | sstore(allowanceSlot, sub(allowance_, amount)) |
| 615 | } |
| 616 | } |
| 617 | } |
| 618 | |
| 619 | /// @dev Sets `amount` as the allowance of `spender` over the tokens of `owner`. |
| 620 | /// |
| 621 | /// Emits a {Approval} event. |
| 622 | function _approve(address owner, address spender, uint256 amount) internal virtual { |
| 623 | if (_givePermit2InfiniteAllowance()) { |
| 624 | /// @solidity memory-safe-assembly |
| 625 | assembly { |
| 626 | // If `spender == _PERMIT2 && amount != type(uint256).max`. |
| 627 | if iszero(or(xor(shr(96, shl(96, spender)), _PERMIT2), iszero(not(amount)))) { |
| 628 | mstore(0x00, 0x3f68539a) // `Permit2AllowanceIsFixedAtInfinity()`. |
| 629 | revert(0x1c, 0x04) |
| 630 | } |
| 631 | } |
| 632 | } |
| 633 | /// @solidity memory-safe-assembly |
| 634 | assembly { |
| 635 | let owner_ := shl(96, owner) |
| 636 | // Compute the allowance slot and store the amount. |
| 637 | mstore(0x20, spender) |
| 638 | mstore(0x0c, or(owner_, _ALLOWANCE_SLOT_SEED)) |
| 639 | sstore(keccak256(0x0c, 0x34), amount) |
| 640 | // Emit the {Approval} event. |
| 641 | mstore(0x00, amount) |
| 642 | log3(0x00, 0x20, _APPROVAL_EVENT_SIGNATURE, shr(96, owner_), shr(96, mload(0x2c))) |
| 643 | } |
| 644 | } |
| 645 | |
| 646 | /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ |
| 647 | /* HOOKS TO OVERRIDE */ |
| 648 | /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ |
| 649 | |
| 650 | /// @dev Hook that is called before any transfer of tokens. |
| 651 | /// This includes minting and burning. |
| 652 | function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual {} |
| 653 | |
| 654 | /// @dev Hook that is called after any transfer of tokens. |
| 655 | /// This includes minting and burning. |
| 656 | function _afterTokenTransfer(address from, address to, uint256 amount) internal virtual {} |
| 657 | |
| 658 | /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ |
| 659 | /* PERMIT2 */ |
| 660 | /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ |
| 661 | |
| 662 | /// @dev Returns whether to fix the Permit2 contract's allowance at infinity. |
| 663 | /// |
| 664 | /// This value should be kept constant after contract initialization, |
| 665 | /// or else the actual allowance values may not match with the {Approval} events. |
| 666 | /// For best performance, return a compile-time constant for zero-cost abstraction. |
| 667 | function _givePermit2InfiniteAllowance() internal view virtual returns (bool) { |
| 668 | return true; |
| 669 | } |
| 670 | } |
| 671 |
50.0%
lib/solady/src/utils/LibClone.sol
Lines covered: 2 / 4 (50.0%)
| 1 | // SPDX-License-Identifier: MIT |
| 2 | pragma solidity ^0.8.4; |
| 3 | |
| 4 | /// @notice Minimal proxy library. |
| 5 | /// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/LibClone.sol) |
| 6 | /// @author Minimal proxy by 0age (https://github.com/0age) |
| 7 | /// @author Clones with immutable args by wighawag, zefram.eth, Saw-mon & Natalie |
| 8 | /// (https://github.com/Saw-mon-and-Natalie/clones-with-immutable-args) |
| 9 | /// @author Minimal ERC1967 proxy by jtriley-eth (https://github.com/jtriley-eth/minimum-viable-proxy) |
| 10 | /// |
| 11 | /// @dev Minimal proxy: |
| 12 | /// Although the sw0nt pattern saves 5 gas over the ERC1167 pattern during runtime, |
| 13 | /// it is not supported out-of-the-box on Etherscan. Hence, we choose to use the 0age pattern, |
| 14 | /// which saves 4 gas over the ERC1167 pattern during runtime, and has the smallest bytecode. |
| 15 | /// - Automatically verified on Etherscan. |
| 16 | /// |
| 17 | /// @dev Minimal proxy (PUSH0 variant): |
| 18 | /// This is a new minimal proxy that uses the PUSH0 opcode introduced during Shanghai. |
| 19 | /// It is optimized first for minimal runtime gas, then for minimal bytecode. |
| 20 | /// The PUSH0 clone functions are intentionally postfixed with a jarring "_PUSH0" as |
| 21 | /// many EVM chains may not support the PUSH0 opcode in the early months after Shanghai. |
| 22 | /// Please use with caution. |
| 23 | /// - Automatically verified on Etherscan. |
| 24 | /// |
| 25 | /// @dev Clones with immutable args (CWIA): |
| 26 | /// The implementation of CWIA here does NOT append the immutable args into the calldata |
| 27 | /// passed into delegatecall. It is simply an ERC1167 minimal proxy with the immutable arguments |
| 28 | /// appended to the back of the runtime bytecode. |
| 29 | /// - Uses the identity precompile (0x4) to copy args during deployment. |
| 30 | /// |
| 31 | /// @dev Minimal ERC1967 proxy: |
| 32 | /// A minimal ERC1967 proxy, intended to be upgraded with UUPS. |
| 33 | /// This is NOT the same as ERC1967Factory's transparent proxy, which includes admin logic. |
| 34 | /// - Automatically verified on Etherscan. |
| 35 | /// |
| 36 | /// @dev Minimal ERC1967 proxy with immutable args: |
| 37 | /// - Uses the identity precompile (0x4) to copy args during deployment. |
| 38 | /// - Automatically verified on Etherscan. |
| 39 | /// |
| 40 | /// @dev ERC1967I proxy: |
| 41 | /// A variant of the minimal ERC1967 proxy, with a special code path that activates |
| 42 | /// if `calldatasize() == 1`. This code path skips the delegatecall and directly returns the |
| 43 | /// `implementation` address. The returned implementation is guaranteed to be valid if the |
| 44 | /// keccak256 of the proxy's code is equal to `ERC1967I_CODE_HASH`. |
| 45 | /// |
| 46 | /// @dev ERC1967I proxy with immutable args: |
| 47 | /// A variant of the minimal ERC1967 proxy, with a special code path that activates |
| 48 | /// if `calldatasize() == 1`. This code path skips the delegatecall and directly returns the |
| 49 | /// - Uses the identity precompile (0x4) to copy args during deployment. |
| 50 | /// |
| 51 | /// @dev Minimal ERC1967 beacon proxy: |
| 52 | /// A minimal beacon proxy, intended to be upgraded with an upgradable beacon. |
| 53 | /// - Automatically verified on Etherscan. |
| 54 | /// |
| 55 | /// @dev Minimal ERC1967 beacon proxy with immutable args: |
| 56 | /// - Uses the identity precompile (0x4) to copy args during deployment. |
| 57 | /// - Automatically verified on Etherscan. |
| 58 | /// |
| 59 | /// @dev ERC1967I beacon proxy: |
| 60 | /// A variant of the minimal ERC1967 beacon proxy, with a special code path that activates |
| 61 | /// if `calldatasize() == 1`. This code path skips the delegatecall and directly returns the |
| 62 | /// `implementation` address. The returned implementation is guaranteed to be valid if the |
| 63 | /// keccak256 of the proxy's code is equal to `ERC1967I_CODE_HASH`. |
| 64 | /// |
| 65 | /// @dev ERC1967I proxy with immutable args: |
| 66 | /// A variant of the minimal ERC1967 beacon proxy, with a special code path that activates |
| 67 | /// if `calldatasize() == 1`. This code path skips the delegatecall and directly returns the |
| 68 | /// - Uses the identity precompile (0x4) to copy args during deployment. |
| 69 | library LibClone { |
| 70 | /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ |
| 71 | /* CONSTANTS */ |
| 72 | /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ |
| 73 | |
| 74 | /// @dev The keccak256 of deployed code for the clone proxy, |
| 75 | /// with the implementation set to `address(0)`. |
| 76 | bytes32 internal constant CLONE_CODE_HASH = |
| 77 | 0x48db2cfdb2853fce0b464f1f93a1996469459df3ab6c812106074c4106a1eb1f; |
| 78 | |
| 79 | /// @dev The keccak256 of deployed code for the PUSH0 proxy, |
| 80 | /// with the implementation set to `address(0)`. |
| 81 | bytes32 internal constant PUSH0_CLONE_CODE_HASH = |
| 82 | 0x67bc6bde1b84d66e267c718ba44cf3928a615d29885537955cb43d44b3e789dc; |
| 83 | |
| 84 | /// @dev The keccak256 of deployed code for the ERC-1167 CWIA proxy, |
| 85 | /// with the implementation set to `address(0)`. |
| 86 | bytes32 internal constant CWIA_CODE_HASH = |
| 87 | 0x3cf92464268225a4513da40a34d967354684c32cd0edd67b5f668dfe3550e940; |
| 88 | |
| 89 | /// @dev The keccak256 of the deployed code for the ERC1967 proxy. |
| 90 | bytes32 internal constant ERC1967_CODE_HASH = |
| 91 | 0xaaa52c8cc8a0e3fd27ce756cc6b4e70c51423e9b597b11f32d3e49f8b1fc890d; |
| 92 | |
| 93 | /// @dev The keccak256 of the deployed code for the ERC1967I proxy. |
| 94 | bytes32 internal constant ERC1967I_CODE_HASH = |
| 95 | 0xce700223c0d4cea4583409accfc45adac4a093b3519998a9cbbe1504dadba6f7; |
| 96 | |
| 97 | /// @dev The keccak256 of the deployed code for the ERC1967 beacon proxy. |
| 98 | bytes32 internal constant ERC1967_BEACON_PROXY_CODE_HASH = |
| 99 | 0x14044459af17bc4f0f5aa2f658cb692add77d1302c29fe2aebab005eea9d1162; |
| 100 | |
| 101 | /// @dev The keccak256 of the deployed code for the ERC1967 beacon proxy. |
| 102 | bytes32 internal constant ERC1967I_BEACON_PROXY_CODE_HASH = |
| 103 | 0xf8c46d2793d5aa984eb827aeaba4b63aedcab80119212fce827309788735519a; |
| 104 | |
| 105 | /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ |
| 106 | /* CUSTOM ERRORS */ |
| 107 | /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ |
| 108 | |
| 109 | /// @dev Unable to deploy the clone. |
| 110 | error DeploymentFailed(); |
| 111 | |
| 112 | /// @dev The salt must start with either the zero address or `by`. |
| 113 | error SaltDoesNotStartWith(); |
| 114 | |
| 115 | /// @dev The ETH transfer has failed. |
| 116 | error ETHTransferFailed(); |
| 117 | |
| 118 | /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ |
| 119 | /* MINIMAL PROXY OPERATIONS */ |
| 120 | /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ |
| 121 | |
| 122 | /// @dev Deploys a clone of `implementation`. |
| 123 | function clone(address implementation) internal returns (address instance) { |
| 124 | instance = clone(0, implementation); |
| 125 | } |
| 126 | |
| 127 | /// @dev Deploys a clone of `implementation`. |
| 128 | /// Deposits `value` ETH during deployment. |
| 129 | function clone(uint256 value, address implementation) internal returns (address instance) { |
| 130 | /// @solidity memory-safe-assembly |
| 131 | assembly { |
| 132 | /** |
| 133 | * --------------------------------------------------------------------------+ |
| 134 | * CREATION (9 bytes) | |
| 135 | * --------------------------------------------------------------------------| |
| 136 | * Opcode | Mnemonic | Stack | Memory | |
| 137 | * --------------------------------------------------------------------------| |
| 138 | * 60 runSize | PUSH1 runSize | r | | |
| 139 | * 3d | RETURNDATASIZE | 0 r | | |
| 140 | * 81 | DUP2 | r 0 r | | |
| 141 | * 60 offset | PUSH1 offset | o r 0 r | | |
| 142 | * 3d | RETURNDATASIZE | 0 o r 0 r | | |
| 143 | * 39 | CODECOPY | 0 r | [0..runSize): runtime code | |
| 144 | * f3 | RETURN | | [0..runSize): runtime code | |
| 145 | * --------------------------------------------------------------------------| |
| 146 | * RUNTIME (44 bytes) | |
| 147 | * --------------------------------------------------------------------------| |
| 148 | * Opcode | Mnemonic | Stack | Memory | |
| 149 | * --------------------------------------------------------------------------| |
| 150 | * | |
| 151 | * ::: keep some values in stack ::::::::::::::::::::::::::::::::::::::::::: | |
| 152 | * 3d | RETURNDATASIZE | 0 | | |
| 153 | * 3d | RETURNDATASIZE | 0 0 | | |
| 154 | * 3d | RETURNDATASIZE | 0 0 0 | | |
| 155 | * 3d | RETURNDATASIZE | 0 0 0 0 | | |
| 156 | * | |
| 157 | * ::: copy calldata to memory ::::::::::::::::::::::::::::::::::::::::::::: | |
| 158 | * 36 | CALLDATASIZE | cds 0 0 0 0 | | |
| 159 | * 3d | RETURNDATASIZE | 0 cds 0 0 0 0 | | |
| 160 | * 3d | RETURNDATASIZE | 0 0 cds 0 0 0 0 | | |
| 161 | * 37 | CALLDATACOPY | 0 0 0 0 | [0..cds): calldata | |
| 162 | * | |
| 163 | * ::: delegate call to the implementation contract :::::::::::::::::::::::: | |
| 164 | * 36 | CALLDATASIZE | cds 0 0 0 0 | [0..cds): calldata | |
| 165 | * 3d | RETURNDATASIZE | 0 cds 0 0 0 0 | [0..cds): calldata | |
| 166 | * 73 addr | PUSH20 addr | addr 0 cds 0 0 0 0 | [0..cds): calldata | |
| 167 | * 5a | GAS | gas addr 0 cds 0 0 0 0 | [0..cds): calldata | |
| 168 | * f4 | DELEGATECALL | success 0 0 | [0..cds): calldata | |
| 169 | * | |
| 170 | * ::: copy return data to memory :::::::::::::::::::::::::::::::::::::::::: | |
| 171 | * 3d | RETURNDATASIZE | rds success 0 0 | [0..cds): calldata | |
| 172 | * 3d | RETURNDATASIZE | rds rds success 0 0 | [0..cds): calldata | |
| 173 | * 93 | SWAP4 | 0 rds success 0 rds | [0..cds): calldata | |
| 174 | * 80 | DUP1 | 0 0 rds success 0 rds | [0..cds): calldata | |
| 175 | * 3e | RETURNDATACOPY | success 0 rds | [0..rds): returndata | |
| 176 | * | |
| 177 | * 60 0x2a | PUSH1 0x2a | 0x2a success 0 rds | [0..rds): returndata | |
| 178 | * 57 | JUMPI | 0 rds | [0..rds): returndata | |
| 179 | * | |
| 180 | * ::: revert :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: | |
| 181 | * fd | REVERT | | [0..rds): returndata | |
| 182 | * | |
| 183 | * ::: return :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: | |
| 184 | * 5b | JUMPDEST | 0 rds | [0..rds): returndata | |
| 185 | * f3 | RETURN | | [0..rds): returndata | |
| 186 | * --------------------------------------------------------------------------+ |
| 187 | */ |
| 188 | mstore(0x21, 0x5af43d3d93803e602a57fd5bf3) |
| 189 | mstore(0x14, implementation) |
| 190 | mstore(0x00, 0x602c3d8160093d39f33d3d3d3d363d3d37363d73) |
| 191 | instance := create(value, 0x0c, 0x35) |
| 192 | if iszero(instance) { |
| 193 | mstore(0x00, 0x30116425) // `DeploymentFailed()`. |
| 194 | revert(0x1c, 0x04) |
| 195 | } |
| 196 | mstore(0x21, 0) // Restore the overwritten part of the free memory pointer. |
| 197 | } |
| 198 | } |
| 199 | |
| 200 | /// @dev Deploys a deterministic clone of `implementation` with `salt`. |
| 201 | function cloneDeterministic(address implementation, bytes32 salt) |
| 202 | internal |
| 203 | returns (address instance) |
| 204 | { |
| 205 | instance = cloneDeterministic(0, implementation, salt); |
| 206 | } |
| 207 | |
| 208 | /// @dev Deploys a deterministic clone of `implementation` with `salt`. |
| 209 | /// Deposits `value` ETH during deployment. |
| 210 | function cloneDeterministic(uint256 value, address implementation, bytes32 salt) |
| 211 | internal |
| 212 | returns (address instance) |
| 213 | { |
| 214 | /// @solidity memory-safe-assembly |
| 215 | assembly { |
| 216 | mstore(0x21, 0x5af43d3d93803e602a57fd5bf3) |
| 217 | mstore(0x14, implementation) |
| 218 | mstore(0x00, 0x602c3d8160093d39f33d3d3d3d363d3d37363d73) |
| 219 | instance := create2(value, 0x0c, 0x35, salt) |
| 220 | if iszero(instance) { |
| 221 | mstore(0x00, 0x30116425) // `DeploymentFailed()`. |
| 222 | revert(0x1c, 0x04) |
| 223 | } |
| 224 | mstore(0x21, 0) // Restore the overwritten part of the free memory pointer. |
| 225 | } |
| 226 | } |
| 227 | |
| 228 | /// @dev Returns the initialization code of the clone of `implementation`. |
| 229 | function initCode(address implementation) internal pure returns (bytes memory c) { |
| 230 | /// @solidity memory-safe-assembly |
| 231 | assembly { |
| 232 | c := mload(0x40) |
| 233 | mstore(add(c, 0x40), 0x5af43d3d93803e602a57fd5bf30000000000000000000000) |
| 234 | mstore(add(c, 0x28), implementation) |
| 235 | mstore(add(c, 0x14), 0x602c3d8160093d39f33d3d3d3d363d3d37363d73) |
| 236 | mstore(c, 0x35) // Store the length. |
| 237 | mstore(0x40, add(c, 0x60)) // Allocate memory. |
| 238 | } |
| 239 | } |
| 240 | |
| 241 | /// @dev Returns the initialization code hash of the clone of `implementation`. |
| 242 | function initCodeHash(address implementation) internal pure returns (bytes32 hash) { |
| 243 | /// @solidity memory-safe-assembly |
| 244 | assembly { |
| 245 | mstore(0x21, 0x5af43d3d93803e602a57fd5bf3) |
| 246 | mstore(0x14, implementation) |
| 247 | mstore(0x00, 0x602c3d8160093d39f33d3d3d3d363d3d37363d73) |
| 248 | hash := keccak256(0x0c, 0x35) |
| 249 | mstore(0x21, 0) // Restore the overwritten part of the free memory pointer. |
| 250 | } |
| 251 | } |
| 252 | |
| 253 | /// @dev Returns the address of the clone of `implementation`, with `salt` by `deployer`. |
| 254 | /// Note: The returned result has dirty upper 96 bits. Please clean if used in assembly. |
| 255 | function predictDeterministicAddress(address implementation, bytes32 salt, address deployer) |
| 256 | internal |
| 257 | pure |
| 258 | returns (address predicted) |
| 259 | { |
| 260 | bytes32 hash = initCodeHash(implementation); |
| 261 | predicted = predictDeterministicAddress(hash, salt, deployer); |
| 262 | } |
| 263 | |
| 264 | /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ |
| 265 | /* MINIMAL PROXY OPERATIONS (PUSH0 VARIANT) */ |
| 266 | /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ |
| 267 | |
| 268 | /// @dev Deploys a PUSH0 clone of `implementation`. |
| 269 | function clone_PUSH0(address implementation) internal returns (address instance) { |
| 270 | instance = clone_PUSH0(0, implementation); |
| 271 | } |
| 272 | |
| 273 | /// @dev Deploys a PUSH0 clone of `implementation`. |
| 274 | /// Deposits `value` ETH during deployment. |
| 275 | function clone_PUSH0(uint256 value, address implementation) |
| 276 | internal |
| 277 | returns (address instance) |
| 278 | { |
| 279 | /// @solidity memory-safe-assembly |
| 280 | assembly { |
| 281 | /** |
| 282 | * --------------------------------------------------------------------------+ |
| 283 | * CREATION (9 bytes) | |
| 284 | * --------------------------------------------------------------------------| |
| 285 | * Opcode | Mnemonic | Stack | Memory | |
| 286 | * --------------------------------------------------------------------------| |
| 287 | * 60 runSize | PUSH1 runSize | r | | |
| 288 | * 5f | PUSH0 | 0 r | | |
| 289 | * 81 | DUP2 | r 0 r | | |
| 290 | * 60 offset | PUSH1 offset | o r 0 r | | |
| 291 | * 5f | PUSH0 | 0 o r 0 r | | |
| 292 | * 39 | CODECOPY | 0 r | [0..runSize): runtime code | |
| 293 | * f3 | RETURN | | [0..runSize): runtime code | |
| 294 | * --------------------------------------------------------------------------| |
| 295 | * RUNTIME (45 bytes) | |
| 296 | * --------------------------------------------------------------------------| |
| 297 | * Opcode | Mnemonic | Stack | Memory | |
| 298 | * --------------------------------------------------------------------------| |
| 299 | * | |
| 300 | * ::: keep some values in stack ::::::::::::::::::::::::::::::::::::::::::: | |
| 301 | * 5f | PUSH0 | 0 | | |
| 302 | * 5f | PUSH0 | 0 0 | | |
| 303 | * | |
| 304 | * ::: copy calldata to memory ::::::::::::::::::::::::::::::::::::::::::::: | |
| 305 | * 36 | CALLDATASIZE | cds 0 0 | | |
| 306 | * 5f | PUSH0 | 0 cds 0 0 | | |
| 307 | * 5f | PUSH0 | 0 0 cds 0 0 | | |
| 308 | * 37 | CALLDATACOPY | 0 0 | [0..cds): calldata | |
| 309 | * | |
| 310 | * ::: delegate call to the implementation contract :::::::::::::::::::::::: | |
| 311 | * 36 | CALLDATASIZE | cds 0 0 | [0..cds): calldata | |
| 312 | * 5f | PUSH0 | 0 cds 0 0 | [0..cds): calldata | |
| 313 | * 73 addr | PUSH20 addr | addr 0 cds 0 0 | [0..cds): calldata | |
| 314 | * 5a | GAS | gas addr 0 cds 0 0 | [0..cds): calldata | |
| 315 | * f4 | DELEGATECALL | success | [0..cds): calldata | |
| 316 | * | |
| 317 | * ::: copy return data to memory :::::::::::::::::::::::::::::::::::::::::: | |
| 318 | * 3d | RETURNDATASIZE | rds success | [0..cds): calldata | |
| 319 | * 5f | PUSH0 | 0 rds success | [0..cds): calldata | |
| 320 | * 5f | PUSH0 | 0 0 rds success | [0..cds): calldata | |
| 321 | * 3e | RETURNDATACOPY | success | [0..rds): returndata | |
| 322 | * | |
| 323 | * 60 0x29 | PUSH1 0x29 | 0x29 success | [0..rds): returndata | |
| 324 | * 57 | JUMPI | | [0..rds): returndata | |
| 325 | * | |
| 326 | * ::: revert :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: | |
| 327 | * 3d | RETURNDATASIZE | rds | [0..rds): returndata | |
| 328 | * 5f | PUSH0 | 0 rds | [0..rds): returndata | |
| 329 | * fd | REVERT | | [0..rds): returndata | |
| 330 | * | |
| 331 | * ::: return :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: | |
| 332 | * 5b | JUMPDEST | | [0..rds): returndata | |
| 333 | * 3d | RETURNDATASIZE | rds | [0..rds): returndata | |
| 334 | * 5f | PUSH0 | 0 rds | [0..rds): returndata | |
| 335 | * f3 | RETURN | | [0..rds): returndata | |
| 336 | * --------------------------------------------------------------------------+ |
| 337 | */ |
| 338 | mstore(0x24, 0x5af43d5f5f3e6029573d5ffd5b3d5ff3) // 16 |
| 339 | mstore(0x14, implementation) // 20 |
| 340 | mstore(0x00, 0x602d5f8160095f39f35f5f365f5f37365f73) // 9 + 9 |
| 341 | instance := create(value, 0x0e, 0x36) |
| 342 | if iszero(instance) { |
| 343 | mstore(0x00, 0x30116425) // `DeploymentFailed()`. |
| 344 | revert(0x1c, 0x04) |
| 345 | } |
| 346 | mstore(0x24, 0) // Restore the overwritten part of the free memory pointer. |
| 347 | } |
| 348 | } |
| 349 | |
| 350 | /// @dev Deploys a deterministic PUSH0 clone of `implementation` with `salt`. |
| 351 | function cloneDeterministic_PUSH0(address implementation, bytes32 salt) |
| 352 | internal |
| 353 | returns (address instance) |
| 354 | { |
| 355 | instance = cloneDeterministic_PUSH0(0, implementation, salt); |
| 356 | } |
| 357 | |
| 358 | /// @dev Deploys a deterministic PUSH0 clone of `implementation` with `salt`. |
| 359 | /// Deposits `value` ETH during deployment. |
| 360 | function cloneDeterministic_PUSH0(uint256 value, address implementation, bytes32 salt) |
| 361 | internal |
| 362 | returns (address instance) |
| 363 | { |
| 364 | /// @solidity memory-safe-assembly |
| 365 | assembly { |
| 366 | mstore(0x24, 0x5af43d5f5f3e6029573d5ffd5b3d5ff3) // 16 |
| 367 | mstore(0x14, implementation) // 20 |
| 368 | mstore(0x00, 0x602d5f8160095f39f35f5f365f5f37365f73) // 9 + 9 |
| 369 | instance := create2(value, 0x0e, 0x36, salt) |
| 370 | if iszero(instance) { |
| 371 | mstore(0x00, 0x30116425) // `DeploymentFailed()`. |
| 372 | revert(0x1c, 0x04) |
| 373 | } |
| 374 | mstore(0x24, 0) // Restore the overwritten part of the free memory pointer. |
| 375 | } |
| 376 | } |
| 377 | |
| 378 | /// @dev Returns the initialization code of the PUSH0 clone of `implementation`. |
| 379 | function initCode_PUSH0(address implementation) internal pure returns (bytes memory c) { |
| 380 | /// @solidity memory-safe-assembly |
| 381 | assembly { |
| 382 | c := mload(0x40) |
| 383 | mstore(add(c, 0x40), 0x5af43d5f5f3e6029573d5ffd5b3d5ff300000000000000000000) // 16 |
| 384 | mstore(add(c, 0x26), implementation) // 20 |
| 385 | mstore(add(c, 0x12), 0x602d5f8160095f39f35f5f365f5f37365f73) // 9 + 9 |
| 386 | mstore(c, 0x36) // Store the length. |
| 387 | mstore(0x40, add(c, 0x60)) // Allocate memory. |
| 388 | } |
| 389 | } |
| 390 | |
| 391 | /// @dev Returns the initialization code hash of the PUSH0 clone of `implementation`. |
| 392 | function initCodeHash_PUSH0(address implementation) internal pure returns (bytes32 hash) { |
| 393 | /// @solidity memory-safe-assembly |
| 394 | assembly { |
| 395 | mstore(0x24, 0x5af43d5f5f3e6029573d5ffd5b3d5ff3) // 16 |
| 396 | mstore(0x14, implementation) // 20 |
| 397 | mstore(0x00, 0x602d5f8160095f39f35f5f365f5f37365f73) // 9 + 9 |
| 398 | hash := keccak256(0x0e, 0x36) |
| 399 | mstore(0x24, 0) // Restore the overwritten part of the free memory pointer. |
| 400 | } |
| 401 | } |
| 402 | |
| 403 | /// @dev Returns the address of the PUSH0 clone of `implementation`, with `salt` by `deployer`. |
| 404 | /// Note: The returned result has dirty upper 96 bits. Please clean if used in assembly. |
| 405 | function predictDeterministicAddress_PUSH0( |
| 406 | address implementation, |
| 407 | bytes32 salt, |
| 408 | address deployer |
| 409 | ) internal pure returns (address predicted) { |
| 410 | bytes32 hash = initCodeHash_PUSH0(implementation); |
| 411 | predicted = predictDeterministicAddress(hash, salt, deployer); |
| 412 | } |
| 413 | |
| 414 | /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ |
| 415 | /* CLONES WITH IMMUTABLE ARGS OPERATIONS */ |
| 416 | /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ |
| 417 | |
| 418 | /// @dev Deploys a clone of `implementation` with immutable arguments encoded in `args`. |
| 419 | function clone(address implementation, bytes memory args) internal returns (address instance) { |
| 420 | instance = clone(0, implementation, args); |
| 421 | } |
| 422 | |
| 423 | /// @dev Deploys a clone of `implementation` with immutable arguments encoded in `args`. |
| 424 | /// Deposits `value` ETH during deployment. |
| 425 | function clone(uint256 value, address implementation, bytes memory args) |
| 426 | internal |
| 427 | returns (address instance) |
| 428 | { |
| 429 | /// @solidity memory-safe-assembly |
| 430 | assembly { |
| 431 | /** |
| 432 | * ---------------------------------------------------------------------------+ |
| 433 | * CREATION (10 bytes) | |
| 434 | * ---------------------------------------------------------------------------| |
| 435 | * Opcode | Mnemonic | Stack | Memory | |
| 436 | * ---------------------------------------------------------------------------| |
| 437 | * 61 runSize | PUSH2 runSize | r | | |
| 438 | * 3d | RETURNDATASIZE | 0 r | | |
| 439 | * 81 | DUP2 | r 0 r | | |
| 440 | * 60 offset | PUSH1 offset | o r 0 r | | |
| 441 | * 3d | RETURNDATASIZE | 0 o r 0 r | | |
| 442 | * 39 | CODECOPY | 0 r | [0..runSize): runtime code | |
| 443 | * f3 | RETURN | | [0..runSize): runtime code | |
| 444 | * ---------------------------------------------------------------------------| |
| 445 | * RUNTIME (45 bytes + extraLength) | |
| 446 | * ---------------------------------------------------------------------------| |
| 447 | * Opcode | Mnemonic | Stack | Memory | |
| 448 | * ---------------------------------------------------------------------------| |
| 449 | * | |
| 450 | * ::: copy calldata to memory :::::::::::::::::::::::::::::::::::::::::::::: | |
| 451 | * 36 | CALLDATASIZE | cds | | |
| 452 | * 3d | RETURNDATASIZE | 0 cds | | |
| 453 | * 3d | RETURNDATASIZE | 0 0 cds | | |
| 454 | * 37 | CALLDATACOPY | | [0..cds): calldata | |
| 455 | * | |
| 456 | * ::: delegate call to the implementation contract ::::::::::::::::::::::::: | |
| 457 | * 3d | RETURNDATASIZE | 0 | [0..cds): calldata | |
| 458 | * 3d | RETURNDATASIZE | 0 0 | [0..cds): calldata | |
| 459 | * 3d | RETURNDATASIZE | 0 0 0 | [0..cds): calldata | |
| 460 | * 36 | CALLDATASIZE | cds 0 0 0 | [0..cds): calldata | |
| 461 | * 3d | RETURNDATASIZE | 0 cds 0 0 0 0 | [0..cds): calldata | |
| 462 | * 73 addr | PUSH20 addr | addr 0 cds 0 0 0 0 | [0..cds): calldata | |
| 463 | * 5a | GAS | gas addr 0 cds 0 0 0 0 | [0..cds): calldata | |
| 464 | * f4 | DELEGATECALL | success 0 0 | [0..cds): calldata | |
| 465 | * | |
| 466 | * ::: copy return data to memory ::::::::::::::::::::::::::::::::::::::::::: | |
| 467 | * 3d | RETURNDATASIZE | rds success 0 | [0..cds): calldata | |
| 468 | * 82 | DUP3 | 0 rds success 0 | [0..cds): calldata | |
| 469 | * 80 | DUP1 | 0 0 rds success 0 | [0..cds): calldata | |
| 470 | * 3e | RETURNDATACOPY | success 0 | [0..rds): returndata | |
| 471 | * 90 | SWAP1 | 0 success | [0..rds): returndata | |
| 472 | * 3d | RETURNDATASIZE | rds 0 success | [0..rds): returndata | |
| 473 | * 91 | SWAP2 | success 0 rds | [0..rds): returndata | |
| 474 | * | |
| 475 | * 60 0x2b | PUSH1 0x2b | 0x2b success 0 rds | [0..rds): returndata | |
| 476 | * 57 | JUMPI | 0 rds | [0..rds): returndata | |
| 477 | * | |
| 478 | * ::: revert ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: | |
| 479 | * fd | REVERT | | [0..rds): returndata | |
| 480 | * | |
| 481 | * ::: return ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: | |
| 482 | * 5b | JUMPDEST | 0 rds | [0..rds): returndata | |
| 483 | * f3 | RETURN | | [0..rds): returndata | |
| 484 | * ---------------------------------------------------------------------------+ |
| 485 | */ |
| 486 | let m := mload(0x40) |
| 487 | let n := mload(args) |
| 488 | pop(staticcall(gas(), 4, add(args, 0x20), n, add(m, 0x43), n)) |
| 489 | mstore(add(m, 0x23), 0x5af43d82803e903d91602b57fd5bf3) |
| 490 | mstore(add(m, 0x14), implementation) |
| 491 | mstore(m, add(0xfe61002d3d81600a3d39f3363d3d373d3d3d363d73, shl(136, n))) |
| 492 | // Do a out-of-gas revert if `n` is greater than `0xffff - 0x2d = 0xffd2`. |
| 493 | instance := create(value, add(m, add(0x0b, lt(n, 0xffd3))), add(n, 0x37)) |
| 494 | if iszero(instance) { |
| 495 | mstore(0x00, 0x30116425) // `DeploymentFailed()`. |
| 496 | revert(0x1c, 0x04) |
| 497 | } |
| 498 | } |
| 499 | } |
| 500 | |
| 501 | /// @dev Deploys a deterministic clone of `implementation` |
| 502 | /// with immutable arguments encoded in `args` and `salt`. |
| 503 | function cloneDeterministic(address implementation, bytes memory args, bytes32 salt) |
| 504 | internal |
| 505 | returns (address instance) |
| 506 | { |
| 507 | instance = cloneDeterministic(0, implementation, args, salt); |
| 508 | } |
| 509 | |
| 510 | /// @dev Deploys a deterministic clone of `implementation` |
| 511 | /// with immutable arguments encoded in `args` and `salt`. |
| 512 | function cloneDeterministic( |
| 513 | uint256 value, |
| 514 | address implementation, |
| 515 | bytes memory args, |
| 516 | bytes32 salt |
| 517 | ) internal returns (address instance) { |
| 518 | /// @solidity memory-safe-assembly |
| 519 | assembly { |
| 520 | let m := mload(0x40) |
| 521 | let n := mload(args) |
| 522 | pop(staticcall(gas(), 4, add(args, 0x20), n, add(m, 0x43), n)) |
| 523 | mstore(add(m, 0x23), 0x5af43d82803e903d91602b57fd5bf3) |
| 524 | mstore(add(m, 0x14), implementation) |
| 525 | mstore(m, add(0xfe61002d3d81600a3d39f3363d3d373d3d3d363d73, shl(136, n))) |
| 526 | // Do a out-of-gas revert if `n` is greater than `0xffff - 0x2d = 0xffd2`. |
| 527 | instance := create2(value, add(m, add(0x0b, lt(n, 0xffd3))), add(n, 0x37), salt) |
| 528 | if iszero(instance) { |
| 529 | mstore(0x00, 0x30116425) // `DeploymentFailed()`. |
| 530 | revert(0x1c, 0x04) |
| 531 | } |
| 532 | } |
| 533 | } |
| 534 | |
| 535 | /// @dev Deploys a deterministic clone of `implementation` |
| 536 | /// with immutable arguments encoded in `args` and `salt`. |
| 537 | /// This method does not revert if the clone has already been deployed. |
| 538 | function createDeterministicClone(address implementation, bytes memory args, bytes32 salt) |
| 539 | internal |
| 540 | returns (bool alreadyDeployed, address instance) |
| 541 | { |
| 542 | return createDeterministicClone(0, implementation, args, salt); |
| 543 | } |
| 544 | |
| 545 | /// @dev Deploys a deterministic clone of `implementation` |
| 546 | /// with immutable arguments encoded in `args` and `salt`. |
| 547 | /// This method does not revert if the clone has already been deployed. |
| 548 | function createDeterministicClone( |
| 549 | uint256 value, |
| 550 | address implementation, |
| 551 | bytes memory args, |
| 552 | bytes32 salt |
| 553 | ) internal returns (bool alreadyDeployed, address instance) { |
| 554 | /// @solidity memory-safe-assembly |
| 555 | assembly { |
| 556 | let m := mload(0x40) |
| 557 | let n := mload(args) |
| 558 | pop(staticcall(gas(), 4, add(args, 0x20), n, add(m, 0x43), n)) |
| 559 | mstore(add(m, 0x23), 0x5af43d82803e903d91602b57fd5bf3) |
| 560 | mstore(add(m, 0x14), implementation) |
| 561 | // Do a out-of-gas revert if `n` is greater than `0xffff - 0x2d = 0xffd2`. |
| 562 | // forgefmt: disable-next-item |
| 563 | mstore(add(m, gt(n, 0xffd2)), add(0xfe61002d3d81600a3d39f3363d3d373d3d3d363d73, shl(136, n))) |
| 564 | // Compute and store the bytecode hash. |
| 565 | mstore8(0x00, 0xff) // Write the prefix. |
| 566 | mstore(0x35, keccak256(add(m, 0x0c), add(n, 0x37))) |
| 567 | mstore(0x01, shl(96, address())) |
| 568 | mstore(0x15, salt) |
| 569 | instance := keccak256(0x00, 0x55) |
| 570 | for {} 1 {} { |
| 571 | if iszero(extcodesize(instance)) { |
| 572 | instance := create2(value, add(m, 0x0c), add(n, 0x37), salt) |
| 573 | if iszero(instance) { |
| 574 | mstore(0x00, 0x30116425) // `DeploymentFailed()`. |
| 575 | revert(0x1c, 0x04) |
| 576 | } |
| 577 | break |
| 578 | } |
| 579 | alreadyDeployed := 1 |
| 580 | if iszero(value) { break } |
| 581 | if iszero(call(gas(), instance, value, codesize(), 0x00, codesize(), 0x00)) { |
| 582 | mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`. |
| 583 | revert(0x1c, 0x04) |
| 584 | } |
| 585 | break |
| 586 | } |
| 587 | mstore(0x35, 0) // Restore the overwritten part of the free memory pointer. |
| 588 | } |
| 589 | } |
| 590 | |
| 591 | /// @dev Returns the initialization code of the clone of `implementation` |
| 592 | /// using immutable arguments encoded in `args`. |
| 593 | function initCode(address implementation, bytes memory args) |
| 594 | internal |
| 595 | pure |
| 596 | returns (bytes memory c) |
| 597 | { |
| 598 | /// @solidity memory-safe-assembly |
| 599 | assembly { |
| 600 | c := mload(0x40) |
| 601 | let n := mload(args) |
| 602 | // Do a out-of-gas revert if `n` is greater than `0xffff - 0x2d = 0xffd2`. |
| 603 | returndatacopy(returndatasize(), returndatasize(), gt(n, 0xffd2)) |
| 604 | for { let i := 0 } lt(i, n) { i := add(i, 0x20) } { |
| 605 | mstore(add(add(c, 0x57), i), mload(add(add(args, 0x20), i))) |
| 606 | } |
| 607 | mstore(add(c, 0x37), 0x5af43d82803e903d91602b57fd5bf3) |
| 608 | mstore(add(c, 0x28), implementation) |
| 609 | mstore(add(c, 0x14), add(0x61002d3d81600a3d39f3363d3d373d3d3d363d73, shl(136, n))) |
| 610 | mstore(c, add(0x37, n)) // Store the length. |
| 611 | mstore(add(c, add(n, 0x57)), 0) // Zeroize the slot after the bytes. |
| 612 | mstore(0x40, add(c, add(n, 0x77))) // Allocate memory. |
| 613 | } |
| 614 | } |
| 615 | |
| 616 | /// @dev Returns the initialization code hash of the clone of `implementation` |
| 617 | /// using immutable arguments encoded in `args`. |
| 618 | function initCodeHash(address implementation, bytes memory args) |
| 619 | internal |
| 620 | pure |
| 621 | returns (bytes32 hash) |
| 622 | { |
| 623 | /// @solidity memory-safe-assembly |
| 624 | assembly { |
| 625 | let m := mload(0x40) |
| 626 | let n := mload(args) |
| 627 | // Do a out-of-gas revert if `n` is greater than `0xffff - 0x2d = 0xffd2`. |
| 628 | returndatacopy(returndatasize(), returndatasize(), gt(n, 0xffd2)) |
| 629 | for { let i := 0 } lt(i, n) { i := add(i, 0x20) } { |
| 630 | mstore(add(add(m, 0x43), i), mload(add(add(args, 0x20), i))) |
| 631 | } |
| 632 | mstore(add(m, 0x23), 0x5af43d82803e903d91602b57fd5bf3) |
| 633 | mstore(add(m, 0x14), implementation) |
| 634 | mstore(m, add(0x61002d3d81600a3d39f3363d3d373d3d3d363d73, shl(136, n))) |
| 635 | hash := keccak256(add(m, 0x0c), add(n, 0x37)) |
| 636 | } |
| 637 | } |
| 638 | |
| 639 | /// @dev Returns the address of the clone of |
| 640 | /// `implementation` using immutable arguments encoded in `args`, with `salt`, by `deployer`. |
| 641 | /// Note: The returned result has dirty upper 96 bits. Please clean if used in assembly. |
| 642 | function predictDeterministicAddress( |
| 643 | address implementation, |
| 644 | bytes memory data, |
| 645 | bytes32 salt, |
| 646 | address deployer |
| 647 | ) internal pure returns (address predicted) { |
| 648 | bytes32 hash = initCodeHash(implementation, data); |
| 649 | predicted = predictDeterministicAddress(hash, salt, deployer); |
| 650 | } |
| 651 | |
| 652 | /// @dev Equivalent to `argsOnClone(instance, 0, 2 ** 256 - 1)`. |
| 653 | function argsOnClone(address instance) internal view returns (bytes memory args) { |
| 654 | /// @solidity memory-safe-assembly |
| 655 | assembly { |
| 656 | args := mload(0x40) |
| 657 | mstore(args, and(0xffffffffff, sub(extcodesize(instance), 0x2d))) // Store the length. |
| 658 | extcodecopy(instance, add(args, 0x20), 0x2d, add(mload(args), 0x20)) |
| 659 | mstore(0x40, add(mload(args), add(args, 0x40))) // Allocate memory. |
| 660 | } |
| 661 | } |
| 662 | |
| 663 | /// @dev Equivalent to `argsOnClone(instance, start, 2 ** 256 - 1)`. |
| 664 | function argsOnClone(address instance, uint256 start) |
| 665 | internal |
| 666 | view |
| 667 | returns (bytes memory args) |
| 668 | { |
| 669 | /// @solidity memory-safe-assembly |
| 670 | assembly { |
| 671 | args := mload(0x40) |
| 672 | let n := and(0xffffffffff, sub(extcodesize(instance), 0x2d)) |
| 673 | let l := sub(n, and(0xffffff, mul(lt(start, n), start))) |
| 674 | extcodecopy(instance, args, add(start, 0x0d), add(l, 0x40)) |
| 675 | mstore(args, mul(sub(n, start), lt(start, n))) // Store the length. |
| 676 | mstore(0x40, add(args, add(0x40, mload(args)))) // Allocate memory. |
| 677 | } |
| 678 | } |
| 679 | |
| 680 | /// @dev Returns a slice of the immutable arguments on `instance` from `start` to `end`. |
| 681 | /// `start` and `end` will be clamped to the range `[0, args.length]`. |
| 682 | /// The `instance` MUST be deployed via the clone with immutable args functions. |
| 683 | /// Otherwise, the behavior is undefined. |
| 684 | /// Out-of-gas reverts if `instance` does not have any code. |
| 685 | function argsOnClone(address instance, uint256 start, uint256 end) |
| 686 | internal |
| 687 | view |
| 688 | returns (bytes memory args) |
| 689 | { |
| 690 | /// @solidity memory-safe-assembly |
| 691 | assembly { |
| 692 | args := mload(0x40) |
| 693 | if iszero(lt(end, 0xffff)) { end := 0xffff } |
| 694 | let d := mul(sub(end, start), lt(start, end)) |
| 695 | extcodecopy(instance, args, add(start, 0x0d), add(d, 0x20)) |
| 696 | if iszero(and(0xff, mload(add(args, d)))) { |
| 697 | let n := sub(extcodesize(instance), 0x2d) |
| 698 | returndatacopy(returndatasize(), returndatasize(), shr(40, n)) |
| 699 | d := mul(gt(n, start), sub(d, mul(gt(end, n), sub(end, n)))) |
| 700 | } |
| 701 | mstore(args, d) // Store the length. |
| 702 | mstore(add(add(args, 0x20), d), 0) // Zeroize the slot after the bytes. |
| 703 | mstore(0x40, add(add(args, 0x40), d)) // Allocate memory. |
| 704 | } |
| 705 | } |
| 706 | |
| 707 | /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ |
| 708 | /* MINIMAL ERC1967 PROXY OPERATIONS */ |
| 709 | /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ |
| 710 | |
| 711 | // Note: The ERC1967 proxy here is intended to be upgraded with UUPS. |
| 712 | // This is NOT the same as ERC1967Factory's transparent proxy, which includes admin logic. |
| 713 | |
| 714 | /// @dev Deploys a minimal ERC1967 proxy with `implementation`. |
| 715 | function deployERC1967(address implementation) internal returns (address instance) { |
| 716 | instance = deployERC1967(0, implementation); |
| 717 | } |
| 718 | |
| 719 | /// @dev Deploys a minimal ERC1967 proxy with `implementation`. |
| 720 | /// Deposits `value` ETH during deployment. |
| 721 | function deployERC1967(uint256 value, address implementation) |
| 722 | internal |
| 723 | returns (address instance) |
| 724 | { |
| 725 | /// @solidity memory-safe-assembly |
| 726 | assembly { |
| 727 | /** |
| 728 | * ---------------------------------------------------------------------------------+ |
| 729 | * CREATION (34 bytes) | |
| 730 | * ---------------------------------------------------------------------------------| |
| 731 | * Opcode | Mnemonic | Stack | Memory | |
| 732 | * ---------------------------------------------------------------------------------| |
| 733 | * 60 runSize | PUSH1 runSize | r | | |
| 734 | * 3d | RETURNDATASIZE | 0 r | | |
| 735 | * 81 | DUP2 | r 0 r | | |
| 736 | * 60 offset | PUSH1 offset | o r 0 r | | |
| 737 | * 3d | RETURNDATASIZE | 0 o r 0 r | | |
| 738 | * 39 | CODECOPY | 0 r | [0..runSize): runtime code | |
| 739 | * 73 impl | PUSH20 impl | impl 0 r | [0..runSize): runtime code | |
| 740 | * 60 slotPos | PUSH1 slotPos | slotPos impl 0 r | [0..runSize): runtime code | |
| 741 | * 51 | MLOAD | slot impl 0 r | [0..runSize): runtime code | |
| 742 | * 55 | SSTORE | 0 r | [0..runSize): runtime code | |
| 743 | * f3 | RETURN | | [0..runSize): runtime code | |
| 744 | * ---------------------------------------------------------------------------------| |
| 745 | * RUNTIME (61 bytes) | |
| 746 | * ---------------------------------------------------------------------------------| |
| 747 | * Opcode | Mnemonic | Stack | Memory | |
| 748 | * ---------------------------------------------------------------------------------| |
| 749 | * | |
| 750 | * ::: copy calldata to memory :::::::::::::::::::::::::::::::::::::::::::::::::::: | |
| 751 | * 36 | CALLDATASIZE | cds | | |
| 752 | * 3d | RETURNDATASIZE | 0 cds | | |
| 753 | * 3d | RETURNDATASIZE | 0 0 cds | | |
| 754 | * 37 | CALLDATACOPY | | [0..calldatasize): calldata | |
| 755 | * | |
| 756 | * ::: delegatecall to implementation ::::::::::::::::::::::::::::::::::::::::::::: | |
| 757 | * 3d | RETURNDATASIZE | 0 | | |
| 758 | * 3d | RETURNDATASIZE | 0 0 | | |
| 759 | * 36 | CALLDATASIZE | cds 0 0 | [0..calldatasize): calldata | |
| 760 | * 3d | RETURNDATASIZE | 0 cds 0 0 | [0..calldatasize): calldata | |
| 761 | * 7f slot | PUSH32 slot | s 0 cds 0 0 | [0..calldatasize): calldata | |
| 762 | * 54 | SLOAD | i 0 cds 0 0 | [0..calldatasize): calldata | |
| 763 | * 5a | GAS | g i 0 cds 0 0 | [0..calldatasize): calldata | |
| 764 | * f4 | DELEGATECALL | succ | [0..calldatasize): calldata | |
| 765 | * | |
| 766 | * ::: copy returndata to memory :::::::::::::::::::::::::::::::::::::::::::::::::: | |
| 767 | * 3d | RETURNDATASIZE | rds succ | [0..calldatasize): calldata | |
| 768 | * 60 0x00 | PUSH1 0x00 | 0 rds succ | [0..calldatasize): calldata | |
| 769 | * 80 | DUP1 | 0 0 rds succ | [0..calldatasize): calldata | |
| 770 | * 3e | RETURNDATACOPY | succ | [0..returndatasize): returndata | |
| 771 | * | |
| 772 | * ::: branch on delegatecall status :::::::::::::::::::::::::::::::::::::::::::::: | |
| 773 | * 60 0x38 | PUSH1 0x38 | dest succ | [0..returndatasize): returndata | |
| 774 | * 57 | JUMPI | | [0..returndatasize): returndata | |
| 775 | * | |
| 776 | * ::: delegatecall failed, revert :::::::::::::::::::::::::::::::::::::::::::::::: | |
| 777 | * 3d | RETURNDATASIZE | rds | [0..returndatasize): returndata | |
| 778 | * 60 0x00 | PUSH1 0x00 | 0 rds | [0..returndatasize): returndata | |
| 779 | * fd | REVERT | | [0..returndatasize): returndata | |
| 780 | * | |
| 781 | * ::: delegatecall succeeded, return ::::::::::::::::::::::::::::::::::::::::::::: | |
| 782 | * 5b | JUMPDEST | | [0..returndatasize): returndata | |
| 783 | * 3d | RETURNDATASIZE | rds | [0..returndatasize): returndata | |
| 784 | * 60 0x00 | PUSH1 0x00 | 0 rds | [0..returndatasize): returndata | |
| 785 | * f3 | RETURN | | [0..returndatasize): returndata | |
| 786 | * ---------------------------------------------------------------------------------+ |
| 787 | */ |
| 788 | let m := mload(0x40) // Cache the free memory pointer. |
| 789 | mstore(0x60, 0xcc3735a920a3ca505d382bbc545af43d6000803e6038573d6000fd5b3d6000f3) |
| 790 | mstore(0x40, 0x5155f3363d3d373d3d363d7f360894a13ba1a3210667c828492db98dca3e2076) |
| 791 | mstore(0x20, 0x6009) |
| 792 | mstore(0x1e, implementation) |
| 793 | mstore(0x0a, 0x603d3d8160223d3973) |
| 794 | instance := create(value, 0x21, 0x5f) |
| 795 | if iszero(instance) { |
| 796 | mstore(0x00, 0x30116425) // `DeploymentFailed()`. |
| 797 | revert(0x1c, 0x04) |
| 798 | } |
| 799 | mstore(0x40, m) // Restore the free memory pointer. |
| 800 | mstore(0x60, 0) // Restore the zero slot. |
| 801 | } |
| 802 | } |
| 803 | |
| 804 | /// @dev Deploys a deterministic minimal ERC1967 proxy with `implementation` and `salt`. |
| 805 | function deployDeterministicERC1967(address implementation, bytes32 salt) |
| 806 | internal |
| 807 | returns (address instance) |
| 808 | { |
| 809 | instance = deployDeterministicERC1967(0, implementation, salt); |
| 810 | } |
| 811 | |
| 812 | /// @dev Deploys a deterministic minimal ERC1967 proxy with `implementation` and `salt`. |
| 813 | /// Deposits `value` ETH during deployment. |
| 814 | function deployDeterministicERC1967(uint256 value, address implementation, bytes32 salt) |
| 815 | internal |
| 816 | returns (address instance) |
| 817 | { |
| 818 | /// @solidity memory-safe-assembly |
| 819 | assembly { |
| 820 | let m := mload(0x40) // Cache the free memory pointer. |
| 821 | mstore(0x60, 0xcc3735a920a3ca505d382bbc545af43d6000803e6038573d6000fd5b3d6000f3) |
| 822 | mstore(0x40, 0x5155f3363d3d373d3d363d7f360894a13ba1a3210667c828492db98dca3e2076) |
| 823 | mstore(0x20, 0x6009) |
| 824 | mstore(0x1e, implementation) |
| 825 | mstore(0x0a, 0x603d3d8160223d3973) |
| 826 | instance := create2(value, 0x21, 0x5f, salt) |
| 827 | if iszero(instance) { |
| 828 | mstore(0x00, 0x30116425) // `DeploymentFailed()`. |
| 829 | revert(0x1c, 0x04) |
| 830 | } |
| 831 | mstore(0x40, m) // Restore the free memory pointer. |
| 832 | mstore(0x60, 0) // Restore the zero slot. |
| 833 | } |
| 834 | } |
| 835 | |
| 836 | /// @dev Creates a deterministic minimal ERC1967 proxy with `implementation` and `salt`. |
| 837 | /// Note: This method is intended for use in ERC4337 factories, |
| 838 | /// which are expected to NOT revert if the proxy is already deployed. |
| 839 | function createDeterministicERC1967(address implementation, bytes32 salt) |
| 840 | internal |
| 841 | returns (bool alreadyDeployed, address instance) |
| 842 | { |
| 843 | return createDeterministicERC1967(0, implementation, salt); |
| 844 | } |
| 845 | |
| 846 | /// @dev Creates a deterministic minimal ERC1967 proxy with `implementation` and `salt`. |
| 847 | /// Deposits `value` ETH during deployment. |
| 848 | /// Note: This method is intended for use in ERC4337 factories, |
| 849 | /// which are expected to NOT revert if the proxy is already deployed. |
| 850 | function createDeterministicERC1967(uint256 value, address implementation, bytes32 salt) |
| 851 | internal |
| 852 | returns (bool alreadyDeployed, address instance) |
| 853 | { |
| 854 | /// @solidity memory-safe-assembly |
| 855 | assembly { |
| 856 | let m := mload(0x40) // Cache the free memory pointer. |
| 857 | mstore(0x60, 0xcc3735a920a3ca505d382bbc545af43d6000803e6038573d6000fd5b3d6000f3) |
| 858 | mstore(0x40, 0x5155f3363d3d373d3d363d7f360894a13ba1a3210667c828492db98dca3e2076) |
| 859 | mstore(0x20, 0x6009) |
| 860 | mstore(0x1e, implementation) |
| 861 | mstore(0x0a, 0x603d3d8160223d3973) |
| 862 | // Compute and store the bytecode hash. |
| 863 | mstore(add(m, 0x35), keccak256(0x21, 0x5f)) |
| 864 | mstore(m, shl(88, address())) |
| 865 | mstore8(m, 0xff) // Write the prefix. |
| 866 | mstore(add(m, 0x15), salt) |
| 867 | instance := keccak256(m, 0x55) |
| 868 | for {} 1 {} { |
| 869 | if iszero(extcodesize(instance)) { |
| 870 | instance := create2(value, 0x21, 0x5f, salt) |
| 871 | if iszero(instance) { |
| 872 | mstore(0x00, 0x30116425) // `DeploymentFailed()`. |
| 873 | revert(0x1c, 0x04) |
| 874 | } |
| 875 | break |
| 876 | } |
| 877 | alreadyDeployed := 1 |
| 878 | if iszero(value) { break } |
| 879 | if iszero(call(gas(), instance, value, codesize(), 0x00, codesize(), 0x00)) { |
| 880 | mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`. |
| 881 | revert(0x1c, 0x04) |
| 882 | } |
| 883 | break |
| 884 | } |
| 885 | mstore(0x40, m) // Restore the free memory pointer. |
| 886 | mstore(0x60, 0) // Restore the zero slot. |
| 887 | } |
| 888 | } |
| 889 | |
| 890 | /// @dev Returns the initialization code of the minimal ERC1967 proxy of `implementation`. |
| 891 | function initCodeERC1967(address implementation) internal pure returns (bytes memory c) { |
| 892 | /// @solidity memory-safe-assembly |
| 893 | assembly { |
| 894 | c := mload(0x40) |
| 895 | mstore(add(c, 0x60), 0x3735a920a3ca505d382bbc545af43d6000803e6038573d6000fd5b3d6000f300) |
| 896 | mstore(add(c, 0x40), 0x55f3363d3d373d3d363d7f360894a13ba1a3210667c828492db98dca3e2076cc) |
| 897 | mstore(add(c, 0x20), or(shl(24, implementation), 0x600951)) |
| 898 | mstore(add(c, 0x09), 0x603d3d8160223d3973) |
| 899 | mstore(c, 0x5f) // Store the length. |
| 900 | mstore(0x40, add(c, 0x80)) // Allocate memory. |
| 901 | } |
| 902 | } |
| 903 | |
| 904 | /// @dev Returns the initialization code hash of the minimal ERC1967 proxy of `implementation`. |
| 905 | function initCodeHashERC1967(address implementation) internal pure returns (bytes32 hash) { |
| 906 | /// @solidity memory-safe-assembly |
| 907 | assembly { |
| 908 | let m := mload(0x40) // Cache the free memory pointer. |
| 909 | mstore(0x60, 0xcc3735a920a3ca505d382bbc545af43d6000803e6038573d6000fd5b3d6000f3) |
| 910 | mstore(0x40, 0x5155f3363d3d373d3d363d7f360894a13ba1a3210667c828492db98dca3e2076) |
| 911 | mstore(0x20, 0x6009) |
| 912 | mstore(0x1e, implementation) |
| 913 | mstore(0x0a, 0x603d3d8160223d3973) |
| 914 | hash := keccak256(0x21, 0x5f) |
| 915 | mstore(0x40, m) // Restore the free memory pointer. |
| 916 | mstore(0x60, 0) // Restore the zero slot. |
| 917 | } |
| 918 | } |
| 919 | |
| 920 | /// @dev Returns the address of the ERC1967 proxy of `implementation`, with `salt` by `deployer`. |
| 921 | /// Note: The returned result has dirty upper 96 bits. Please clean if used in assembly. |
| 922 | function predictDeterministicAddressERC1967( |
| 923 | address implementation, |
| 924 | bytes32 salt, |
| 925 | address deployer |
| 926 | ) internal pure returns (address predicted) { |
| 927 | bytes32 hash = initCodeHashERC1967(implementation); |
| 928 | predicted = predictDeterministicAddress(hash, salt, deployer); |
| 929 | } |
| 930 | |
| 931 | /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ |
| 932 | /* MINIMAL ERC1967 PROXY WITH IMMUTABLE ARGS OPERATIONS */ |
| 933 | /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ |
| 934 | |
| 935 | /// @dev Deploys a minimal ERC1967 proxy with `implementation` and `args`. |
| 936 | function deployERC1967(address implementation, bytes memory args) |
| 937 | internal |
| 938 | returns (address instance) |
| 939 | { |
| 940 | instance = deployERC1967(0, implementation, args); |
| 941 | } |
| 942 | |
| 943 | /// @dev Deploys a minimal ERC1967 proxy with `implementation` and `args`. |
| 944 | /// Deposits `value` ETH during deployment. |
| 945 | function deployERC1967(uint256 value, address implementation, bytes memory args) |
| 946 | internal |
| 947 | returns (address instance) |
| 948 | { |
| 949 | /// @solidity memory-safe-assembly |
| 950 | assembly { |
| 951 | let m := mload(0x40) |
| 952 | let n := mload(args) |
| 953 | pop(staticcall(gas(), 4, add(args, 0x20), n, add(m, 0x60), n)) |
| 954 | mstore(add(m, 0x40), 0xcc3735a920a3ca505d382bbc545af43d6000803e6038573d6000fd5b3d6000f3) |
| 955 | mstore(add(m, 0x20), 0x5155f3363d3d373d3d363d7f360894a13ba1a3210667c828492db98dca3e2076) |
| 956 | mstore(0x16, 0x6009) |
| 957 | mstore(0x14, implementation) |
| 958 | // Do a out-of-gas revert if `n` is greater than `0xffff - 0x3d = 0xffc2`. |
| 959 | mstore(gt(n, 0xffc2), add(0xfe61003d3d8160233d3973, shl(56, n))) |
| 960 | mstore(m, mload(0x16)) |
| 961 | instance := create(value, m, add(n, 0x60)) |
| 962 | if iszero(instance) { |
| 963 | mstore(0x00, 0x30116425) // `DeploymentFailed()`. |
| 964 | revert(0x1c, 0x04) |
| 965 | } |
| 966 | } |
| 967 | } |
| 968 | |
| 969 | /// @dev Deploys a deterministic minimal ERC1967 proxy with `implementation`, `args` and `salt`. |
| 970 | function deployDeterministicERC1967(address implementation, bytes memory args, bytes32 salt) |
| 971 | internal |
| 972 | returns (address instance) |
| 973 | { |
| 974 | instance = deployDeterministicERC1967(0, implementation, args, salt); |
| 975 | } |
| 976 | |
| 977 | /// @dev Deploys a deterministic minimal ERC1967 proxy with `implementation`, `args` and `salt`. |
| 978 | /// Deposits `value` ETH during deployment. |
| 979 | function deployDeterministicERC1967( |
| 980 | uint256 value, |
| 981 | address implementation, |
| 982 | bytes memory args, |
| 983 | bytes32 salt |
| 984 | ) internal returns (address instance) { |
| 985 | /// @solidity memory-safe-assembly |
| 986 | assembly { |
| 987 | let m := mload(0x40) |
| 988 | let n := mload(args) |
| 989 | pop(staticcall(gas(), 4, add(args, 0x20), n, add(m, 0x60), n)) |
| 990 | mstore(add(m, 0x40), 0xcc3735a920a3ca505d382bbc545af43d6000803e6038573d6000fd5b3d6000f3) |
| 991 | mstore(add(m, 0x20), 0x5155f3363d3d373d3d363d7f360894a13ba1a3210667c828492db98dca3e2076) |
| 992 | mstore(0x16, 0x6009) |
| 993 | mstore(0x14, implementation) |
| 994 | // Do a out-of-gas revert if `n` is greater than `0xffff - 0x3d = 0xffc2`. |
| 995 | mstore(gt(n, 0xffc2), add(0xfe61003d3d8160233d3973, shl(56, n))) |
| 996 | mstore(m, mload(0x16)) |
| 997 | instance := create2(value, m, add(n, 0x60), salt) |
| 998 | if iszero(instance) { |
| 999 | mstore(0x00, 0x30116425) // `DeploymentFailed()`. |
| 1000 | revert(0x1c, 0x04) |
| 1001 | } |
| 1002 | } |
| 1003 | } |
| 1004 | |
| 1005 | /// @dev Creates a deterministic minimal ERC1967 proxy with `implementation`, `args` and `salt`. |
| 1006 | /// Note: This method is intended for use in ERC4337 factories, |
| 1007 | /// which are expected to NOT revert if the proxy is already deployed. |
| 1008 | function createDeterministicERC1967(address implementation, bytes memory args, bytes32 salt) |
| 1009 | internal |
| 1010 | returns (bool alreadyDeployed, address instance) |
| 1011 | { |
| 1012 | return createDeterministicERC1967(0, implementation, args, salt); |
| 1013 | } |
| 1014 | |
| 1015 | /// @dev Creates a deterministic minimal ERC1967 proxy with `implementation`, `args` and `salt`. |
| 1016 | /// Deposits `value` ETH during deployment. |
| 1017 | /// Note: This method is intended for use in ERC4337 factories, |
| 1018 | /// which are expected to NOT revert if the proxy is already deployed. |
| 1019 | function createDeterministicERC1967( |
| 1020 | uint256 value, |
| 1021 | address implementation, |
| 1022 | bytes memory args, |
| 1023 | bytes32 salt |
| 1024 | ) internal returns (bool alreadyDeployed, address instance) { |
| 1025 | /// @solidity memory-safe-assembly |
| 1026 | assembly { |
| 1027 | let m := mload(0x40) |
| 1028 | let n := mload(args) |
| 1029 | pop(staticcall(gas(), 4, add(args, 0x20), n, add(m, 0x60), n)) |
| 1030 | mstore(add(m, 0x40), 0xcc3735a920a3ca505d382bbc545af43d6000803e6038573d6000fd5b3d6000f3) |
| 1031 | mstore(add(m, 0x20), 0x5155f3363d3d373d3d363d7f360894a13ba1a3210667c828492db98dca3e2076) |
| 1032 | mstore(0x16, 0x6009) |
| 1033 | mstore(0x14, implementation) |
| 1034 | // Do a out-of-gas revert if `n` is greater than `0xffff - 0x3d = 0xffc2`. |
| 1035 | mstore(gt(n, 0xffc2), add(0xfe61003d3d8160233d3973, shl(56, n))) |
| 1036 | mstore(m, mload(0x16)) |
| 1037 | // Compute and store the bytecode hash. |
| 1038 | mstore8(0x00, 0xff) // Write the prefix. |
| 1039 | mstore(0x35, keccak256(m, add(n, 0x60))) |
| 1040 | mstore(0x01, shl(96, address())) |
| 1041 | mstore(0x15, salt) |
| 1042 | instance := keccak256(0x00, 0x55) |
| 1043 | for {} 1 {} { |
| 1044 | if iszero(extcodesize(instance)) { |
| 1045 | instance := create2(value, m, add(n, 0x60), salt) |
| 1046 | if iszero(instance) { |
| 1047 | mstore(0x00, 0x30116425) // `DeploymentFailed()`. |
| 1048 | revert(0x1c, 0x04) |
| 1049 | } |
| 1050 | break |
| 1051 | } |
| 1052 | alreadyDeployed := 1 |
| 1053 | if iszero(value) { break } |
| 1054 | if iszero(call(gas(), instance, value, codesize(), 0x00, codesize(), 0x00)) { |
| 1055 | mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`. |
| 1056 | revert(0x1c, 0x04) |
| 1057 | } |
| 1058 | break |
| 1059 | } |
| 1060 | mstore(0x35, 0) // Restore the overwritten part of the free memory pointer. |
| 1061 | } |
| 1062 | } |
| 1063 | |
| 1064 | /// @dev Returns the initialization code of the minimal ERC1967 proxy of `implementation` and `args`. |
| 1065 | function initCodeERC1967(address implementation, bytes memory args) |
| 1066 | internal |
| 1067 | pure |
| 1068 | returns (bytes memory c) |
| 1069 | { |
| 1070 | /// @solidity memory-safe-assembly |
| 1071 | assembly { |
| 1072 | c := mload(0x40) |
| 1073 | let n := mload(args) |
| 1074 | // Do a out-of-gas revert if `n` is greater than `0xffff - 0x3d = 0xffc2`. |
| 1075 | returndatacopy(returndatasize(), returndatasize(), gt(n, 0xffc2)) |
| 1076 | for { let i := 0 } lt(i, n) { i := add(i, 0x20) } { |
| 1077 | mstore(add(add(c, 0x80), i), mload(add(add(args, 0x20), i))) |
| 1078 | } |
| 1079 | mstore(add(c, 0x60), 0xcc3735a920a3ca505d382bbc545af43d6000803e6038573d6000fd5b3d6000f3) |
| 1080 | mstore(add(c, 0x40), 0x5155f3363d3d373d3d363d7f360894a13ba1a3210667c828492db98dca3e2076) |
| 1081 | mstore(add(c, 0x20), 0x6009) |
| 1082 | mstore(add(c, 0x1e), implementation) |
| 1083 | mstore(add(c, 0x0a), add(0x61003d3d8160233d3973, shl(56, n))) |
| 1084 | mstore(c, add(n, 0x60)) // Store the length. |
| 1085 | mstore(add(c, add(n, 0x80)), 0) // Zeroize the slot after the bytes. |
| 1086 | mstore(0x40, add(c, add(n, 0xa0))) // Allocate memory. |
| 1087 | } |
| 1088 | } |
| 1089 | |
| 1090 | /// @dev Returns the initialization code hash of the minimal ERC1967 proxy of `implementation` and `args`. |
| 1091 | function initCodeHashERC1967(address implementation, bytes memory args) |
| 1092 | internal |
| 1093 | pure |
| 1094 | returns (bytes32 hash) |
| 1095 | { |
| 1096 | /// @solidity memory-safe-assembly |
| 1097 | assembly { |
| 1098 | let m := mload(0x40) |
| 1099 | let n := mload(args) |
| 1100 | // Do a out-of-gas revert if `n` is greater than `0xffff - 0x3d = 0xffc2`. |
| 1101 | returndatacopy(returndatasize(), returndatasize(), gt(n, 0xffc2)) |
| 1102 | for { let i := 0 } lt(i, n) { i := add(i, 0x20) } { |
| 1103 | mstore(add(add(m, 0x60), i), mload(add(add(args, 0x20), i))) |
| 1104 | } |
| 1105 | mstore(add(m, 0x40), 0xcc3735a920a3ca505d382bbc545af43d6000803e6038573d6000fd5b3d6000f3) |
| 1106 | mstore(add(m, 0x20), 0x5155f3363d3d373d3d363d7f360894a13ba1a3210667c828492db98dca3e2076) |
| 1107 | mstore(0x16, 0x6009) |
| 1108 | mstore(0x14, implementation) |
| 1109 | mstore(0x00, add(0x61003d3d8160233d3973, shl(56, n))) |
| 1110 | mstore(m, mload(0x16)) |
| 1111 | hash := keccak256(m, add(n, 0x60)) |
| 1112 | } |
| 1113 | } |
| 1114 | |
| 1115 | /// @dev Returns the address of the ERC1967 proxy of `implementation`, `args`, with `salt` by `deployer`. |
| 1116 | /// Note: The returned result has dirty upper 96 bits. Please clean if used in assembly. |
| 1117 | function predictDeterministicAddressERC1967( |
| 1118 | address implementation, |
| 1119 | bytes memory args, |
| 1120 | bytes32 salt, |
| 1121 | address deployer |
| 1122 | ) internal pure returns (address predicted) { |
| 1123 | bytes32 hash = initCodeHashERC1967(implementation, args); |
| 1124 | predicted = predictDeterministicAddress(hash, salt, deployer); |
| 1125 | } |
| 1126 | |
| 1127 | /// @dev Equivalent to `argsOnERC1967(instance, start, 2 ** 256 - 1)`. |
| 1128 | function argsOnERC1967(address instance) internal view returns (bytes memory args) { |
| 1129 | /// @solidity memory-safe-assembly |
| 1130 | assembly { |
| 1131 | args := mload(0x40) |
| 1132 | mstore(args, and(0xffffffffff, sub(extcodesize(instance), 0x3d))) // Store the length. |
| 1133 | extcodecopy(instance, add(args, 0x20), 0x3d, add(mload(args), 0x20)) |
| 1134 | mstore(0x40, add(mload(args), add(args, 0x40))) // Allocate memory. |
| 1135 | } |
| 1136 | } |
| 1137 | |
| 1138 | /// @dev Equivalent to `argsOnERC1967(instance, start, 2 ** 256 - 1)`. |
| 1139 | function argsOnERC1967(address instance, uint256 start) |
| 1140 | internal |
| 1141 | view |
| 1142 | returns (bytes memory args) |
| 1143 | { |
| 1144 | /// @solidity memory-safe-assembly |
| 1145 | assembly { |
| 1146 | args := mload(0x40) |
| 1147 | let n := and(0xffffffffff, sub(extcodesize(instance), 0x3d)) |
| 1148 | let l := sub(n, and(0xffffff, mul(lt(start, n), start))) |
| 1149 | extcodecopy(instance, args, add(start, 0x1d), add(l, 0x40)) |
| 1150 | mstore(args, mul(sub(n, start), lt(start, n))) // Store the length. |
| 1151 | mstore(0x40, add(args, add(0x40, mload(args)))) // Allocate memory. |
| 1152 | } |
| 1153 | } |
| 1154 | |
| 1155 | /// @dev Returns a slice of the immutable arguments on `instance` from `start` to `end`. |
| 1156 | /// `start` and `end` will be clamped to the range `[0, args.length]`. |
| 1157 | /// The `instance` MUST be deployed via the ERC1967 with immutable args functions. |
| 1158 | /// Otherwise, the behavior is undefined. |
| 1159 | /// Out-of-gas reverts if `instance` does not have any code. |
| 1160 | function argsOnERC1967(address instance, uint256 start, uint256 end) |
| 1161 | internal |
| 1162 | view |
| 1163 | returns (bytes memory args) |
| 1164 | { |
| 1165 | /// @solidity memory-safe-assembly |
| 1166 | assembly { |
| 1167 | args := mload(0x40) |
| 1168 | if iszero(lt(end, 0xffff)) { end := 0xffff } |
| 1169 | let d := mul(sub(end, start), lt(start, end)) |
| 1170 | extcodecopy(instance, args, add(start, 0x1d), add(d, 0x20)) |
| 1171 | if iszero(and(0xff, mload(add(args, d)))) { |
| 1172 | let n := sub(extcodesize(instance), 0x3d) |
| 1173 | returndatacopy(returndatasize(), returndatasize(), shr(40, n)) |
| 1174 | d := mul(gt(n, start), sub(d, mul(gt(end, n), sub(end, n)))) |
| 1175 | } |
| 1176 | mstore(args, d) // Store the length. |
| 1177 | mstore(add(add(args, 0x20), d), 0) // Zeroize the slot after the bytes. |
| 1178 | mstore(0x40, add(add(args, 0x40), d)) // Allocate memory. |
| 1179 | } |
| 1180 | } |
| 1181 | |
| 1182 | /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ |
| 1183 | /* ERC1967I PROXY OPERATIONS */ |
| 1184 | /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ |
| 1185 | |
| 1186 | // Note: This proxy has a special code path that activates if `calldatasize() == 1`. |
| 1187 | // This code path skips the delegatecall and directly returns the `implementation` address. |
| 1188 | // The returned implementation is guaranteed to be valid if the keccak256 of the |
| 1189 | // proxy's code is equal to `ERC1967I_CODE_HASH`. |
| 1190 | |
| 1191 | /// @dev Deploys a ERC1967I proxy with `implementation`. |
| 1192 | function deployERC1967I(address implementation) internal returns (address instance) { |
| 1193 | instance = deployERC1967I(0, implementation); |
| 1194 | } |
| 1195 | |
| 1196 | /// @dev Deploys a ERC1967I proxy with `implementation`. |
| 1197 | /// Deposits `value` ETH during deployment. |
| 1198 | function deployERC1967I(uint256 value, address implementation) |
| 1199 | internal |
| 1200 | returns (address instance) |
| 1201 | { |
| 1202 | /// @solidity memory-safe-assembly |
| 1203 | assembly { |
| 1204 | /** |
| 1205 | * ---------------------------------------------------------------------------------+ |
| 1206 | * CREATION (34 bytes) | |
| 1207 | * ---------------------------------------------------------------------------------| |
| 1208 | * Opcode | Mnemonic | Stack | Memory | |
| 1209 | * ---------------------------------------------------------------------------------| |
| 1210 | * 60 runSize | PUSH1 runSize | r | | |
| 1211 | * 3d | RETURNDATASIZE | 0 r | | |
| 1212 | * 81 | DUP2 | r 0 r | | |
| 1213 | * 60 offset | PUSH1 offset | o r 0 r | | |
| 1214 | * 3d | RETURNDATASIZE | 0 o r 0 r | | |
| 1215 | * 39 | CODECOPY | 0 r | [0..runSize): runtime code | |
| 1216 | * 73 impl | PUSH20 impl | impl 0 r | [0..runSize): runtime code | |
| 1217 | * 60 slotPos | PUSH1 slotPos | slotPos impl 0 r | [0..runSize): runtime code | |
| 1218 | * 51 | MLOAD | slot impl 0 r | [0..runSize): runtime code | |
| 1219 | * 55 | SSTORE | 0 r | [0..runSize): runtime code | |
| 1220 | * f3 | RETURN | | [0..runSize): runtime code | |
| 1221 | * ---------------------------------------------------------------------------------| |
| 1222 | * RUNTIME (82 bytes) | |
| 1223 | * ---------------------------------------------------------------------------------| |
| 1224 | * Opcode | Mnemonic | Stack | Memory | |
| 1225 | * ---------------------------------------------------------------------------------| |
| 1226 | * | |
| 1227 | * ::: check calldatasize ::::::::::::::::::::::::::::::::::::::::::::::::::::::::: | |
| 1228 | * 36 | CALLDATASIZE | cds | | |
| 1229 | * 58 | PC | 1 cds | | |
| 1230 | * 14 | EQ | eqs | | |
| 1231 | * 60 0x43 | PUSH1 0x43 | dest eqs | | |
| 1232 | * 57 | JUMPI | | | |
| 1233 | * | |
| 1234 | * ::: copy calldata to memory :::::::::::::::::::::::::::::::::::::::::::::::::::: | |
| 1235 | * 36 | CALLDATASIZE | cds | | |
| 1236 | * 3d | RETURNDATASIZE | 0 cds | | |
| 1237 | * 3d | RETURNDATASIZE | 0 0 cds | | |
| 1238 | * 37 | CALLDATACOPY | | [0..calldatasize): calldata | |
| 1239 | * | |
| 1240 | * ::: delegatecall to implementation ::::::::::::::::::::::::::::::::::::::::::::: | |
| 1241 | * 3d | RETURNDATASIZE | 0 | | |
| 1242 | * 3d | RETURNDATASIZE | 0 0 | | |
| 1243 | * 36 | CALLDATASIZE | cds 0 0 | [0..calldatasize): calldata | |
| 1244 | * 3d | RETURNDATASIZE | 0 cds 0 0 | [0..calldatasize): calldata | |
| 1245 | * 7f slot | PUSH32 slot | s 0 cds 0 0 | [0..calldatasize): calldata | |
| 1246 | * 54 | SLOAD | i 0 cds 0 0 | [0..calldatasize): calldata | |
| 1247 | * 5a | GAS | g i 0 cds 0 0 | [0..calldatasize): calldata | |
| 1248 | * f4 | DELEGATECALL | succ | [0..calldatasize): calldata | |
| 1249 | * | |
| 1250 | * ::: copy returndata to memory :::::::::::::::::::::::::::::::::::::::::::::::::: | |
| 1251 | * 3d | RETURNDATASIZE | rds succ | [0..calldatasize): calldata | |
| 1252 | * 60 0x00 | PUSH1 0x00 | 0 rds succ | [0..calldatasize): calldata | |
| 1253 | * 80 | DUP1 | 0 0 rds succ | [0..calldatasize): calldata | |
| 1254 | * 3e | RETURNDATACOPY | succ | [0..returndatasize): returndata | |
| 1255 | * | |
| 1256 | * ::: branch on delegatecall status :::::::::::::::::::::::::::::::::::::::::::::: | |
| 1257 | * 60 0x3E | PUSH1 0x3E | dest succ | [0..returndatasize): returndata | |
| 1258 | * 57 | JUMPI | | [0..returndatasize): returndata | |
| 1259 | * | |
| 1260 | * ::: delegatecall failed, revert :::::::::::::::::::::::::::::::::::::::::::::::: | |
| 1261 | * 3d | RETURNDATASIZE | rds | [0..returndatasize): returndata | |
| 1262 | * 60 0x00 | PUSH1 0x00 | 0 rds | [0..returndatasize): returndata | |
| 1263 | * fd | REVERT | | [0..returndatasize): returndata | |
| 1264 | * | |
| 1265 | * ::: delegatecall succeeded, return ::::::::::::::::::::::::::::::::::::::::::::: | |
| 1266 | * 5b | JUMPDEST | | [0..returndatasize): returndata | |
| 1267 | * 3d | RETURNDATASIZE | rds | [0..returndatasize): returndata | |
| 1268 | * 60 0x00 | PUSH1 0x00 | 0 rds | [0..returndatasize): returndata | |
| 1269 | * f3 | RETURN | | [0..returndatasize): returndata | |
| 1270 | * | |
| 1271 | * ::: implementation , return :::::::::::::::::::::::::::::::::::::::::::::::::::: | |
| 1272 | * 5b | JUMPDEST | | | |
| 1273 | * 60 0x20 | PUSH1 0x20 | 32 | | |
| 1274 | * 60 0x0F | PUSH1 0x0F | o 32 | | |
| 1275 | * 3d | RETURNDATASIZE | 0 o 32 | | |
| 1276 | * 39 | CODECOPY | | [0..32): implementation slot | |
| 1277 | * 3d | RETURNDATASIZE | 0 | [0..32): implementation slot | |
| 1278 | * 51 | MLOAD | slot | [0..32): implementation slot | |
| 1279 | * 54 | SLOAD | impl | [0..32): implementation slot | |
| 1280 | * 3d | RETURNDATASIZE | 0 impl | [0..32): implementation slot | |
| 1281 | * 52 | MSTORE | | [0..32): implementation address | |
| 1282 | * 59 | MSIZE | 32 | [0..32): implementation address | |
| 1283 | * 3d | RETURNDATASIZE | 0 32 | [0..32): implementation address | |
| 1284 | * f3 | RETURN | | [0..32): implementation address | |
| 1285 | * ---------------------------------------------------------------------------------+ |
| 1286 | */ |
| 1287 | let m := mload(0x40) // Cache the free memory pointer. |
| 1288 | mstore(0x60, 0x3d6000803e603e573d6000fd5b3d6000f35b6020600f3d393d51543d52593df3) |
| 1289 | mstore(0x40, 0xa13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc545af4) |
| 1290 | mstore(0x20, 0x600f5155f3365814604357363d3d373d3d363d7f360894) |
| 1291 | mstore(0x09, or(shl(160, 0x60523d8160223d3973), shr(96, shl(96, implementation)))) |
| 1292 | instance := create(value, 0x0c, 0x74) |
| 1293 | if iszero(instance) { |
| 1294 | mstore(0x00, 0x30116425) // `DeploymentFailed()`. |
| 1295 | revert(0x1c, 0x04) |
| 1296 | } |
| 1297 | mstore(0x40, m) // Restore the free memory pointer. |
| 1298 | mstore(0x60, 0) // Restore the zero slot. |
| 1299 | } |
| 1300 | } |
| 1301 | |
| 1302 | /// @dev Deploys a deterministic ERC1967I proxy with `implementation` and `salt`. |
| 1303 | function deployDeterministicERC1967I(address implementation, bytes32 salt) |
| 1304 | internal |
| 1305 | returns (address instance) |
| 1306 | { |
| 1307 | instance = deployDeterministicERC1967I(0, implementation, salt); |
| 1308 | } |
| 1309 | |
| 1310 | /// @dev Deploys a deterministic ERC1967I proxy with `implementation` and `salt`. |
| 1311 | /// Deposits `value` ETH during deployment. |
| 1312 | function deployDeterministicERC1967I(uint256 value, address implementation, bytes32 salt) |
| 1313 | internal |
| 1314 | returns (address instance) |
| 1315 | { |
| 1316 | /// @solidity memory-safe-assembly |
| 1317 | assembly { |
| 1318 | let m := mload(0x40) // Cache the free memory pointer. |
| 1319 | mstore(0x60, 0x3d6000803e603e573d6000fd5b3d6000f35b6020600f3d393d51543d52593df3) |
| 1320 | mstore(0x40, 0xa13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc545af4) |
| 1321 | mstore(0x20, 0x600f5155f3365814604357363d3d373d3d363d7f360894) |
| 1322 | mstore(0x09, or(shl(160, 0x60523d8160223d3973), shr(96, shl(96, implementation)))) |
| 1323 | instance := create2(value, 0x0c, 0x74, salt) |
| 1324 | if iszero(instance) { |
| 1325 | mstore(0x00, 0x30116425) // `DeploymentFailed()`. |
| 1326 | revert(0x1c, 0x04) |
| 1327 | } |
| 1328 | mstore(0x40, m) // Restore the free memory pointer. |
| 1329 | mstore(0x60, 0) // Restore the zero slot. |
| 1330 | } |
| 1331 | } |
| 1332 | |
| 1333 | /// @dev Creates a deterministic ERC1967I proxy with `implementation` and `salt`. |
| 1334 | /// Note: This method is intended for use in ERC4337 factories, |
| 1335 | /// which are expected to NOT revert if the proxy is already deployed. |
| 1336 | function createDeterministicERC1967I(address implementation, bytes32 salt) |
| 1337 | internal |
| 1338 | returns (bool alreadyDeployed, address instance) |
| 1339 | { |
| 1340 | return createDeterministicERC1967I(0, implementation, salt); |
| 1341 | } |
| 1342 | |
| 1343 | /// @dev Creates a deterministic ERC1967I proxy with `implementation` and `salt`. |
| 1344 | /// Deposits `value` ETH during deployment. |
| 1345 | /// Note: This method is intended for use in ERC4337 factories, |
| 1346 | /// which are expected to NOT revert if the proxy is already deployed. |
| 1347 | function createDeterministicERC1967I(uint256 value, address implementation, bytes32 salt) |
| 1348 | internal |
| 1349 | returns (bool alreadyDeployed, address instance) |
| 1350 | { |
| 1351 | /// @solidity memory-safe-assembly |
| 1352 | assembly { |
| 1353 | let m := mload(0x40) // Cache the free memory pointer. |
| 1354 | mstore(0x60, 0x3d6000803e603e573d6000fd5b3d6000f35b6020600f3d393d51543d52593df3) |
| 1355 | mstore(0x40, 0xa13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc545af4) |
| 1356 | mstore(0x20, 0x600f5155f3365814604357363d3d373d3d363d7f360894) |
| 1357 | mstore(0x09, or(shl(160, 0x60523d8160223d3973), shr(96, shl(96, implementation)))) |
| 1358 | // Compute and store the bytecode hash. |
| 1359 | mstore(add(m, 0x35), keccak256(0x0c, 0x74)) |
| 1360 | mstore(m, shl(88, address())) |
| 1361 | mstore8(m, 0xff) // Write the prefix. |
| 1362 | mstore(add(m, 0x15), salt) |
| 1363 | instance := keccak256(m, 0x55) |
| 1364 | for {} 1 {} { |
| 1365 | if iszero(extcodesize(instance)) { |
| 1366 | instance := create2(value, 0x0c, 0x74, salt) |
| 1367 | if iszero(instance) { |
| 1368 | mstore(0x00, 0x30116425) // `DeploymentFailed()`. |
| 1369 | revert(0x1c, 0x04) |
| 1370 | } |
| 1371 | break |
| 1372 | } |
| 1373 | alreadyDeployed := 1 |
| 1374 | if iszero(value) { break } |
| 1375 | if iszero(call(gas(), instance, value, codesize(), 0x00, codesize(), 0x00)) { |
| 1376 | mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`. |
| 1377 | revert(0x1c, 0x04) |
| 1378 | } |
| 1379 | break |
| 1380 | } |
| 1381 | mstore(0x40, m) // Restore the free memory pointer. |
| 1382 | mstore(0x60, 0) // Restore the zero slot. |
| 1383 | } |
| 1384 | } |
| 1385 | |
| 1386 | /// @dev Returns the initialization code of the ERC1967I proxy of `implementation`. |
| 1387 | function initCodeERC1967I(address implementation) internal pure returns (bytes memory c) { |
| 1388 | /// @solidity memory-safe-assembly |
| 1389 | assembly { |
| 1390 | c := mload(0x40) |
| 1391 | mstore(add(c, 0x74), 0x3d6000803e603e573d6000fd5b3d6000f35b6020600f3d393d51543d52593df3) |
| 1392 | mstore(add(c, 0x54), 0xa13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc545af4) |
| 1393 | mstore(add(c, 0x34), 0x600f5155f3365814604357363d3d373d3d363d7f360894) |
| 1394 | mstore(add(c, 0x1d), implementation) |
| 1395 | mstore(add(c, 0x09), 0x60523d8160223d3973) |
| 1396 | mstore(add(c, 0x94), 0) |
| 1397 | mstore(c, 0x74) // Store the length. |
| 1398 | mstore(0x40, add(c, 0xa0)) // Allocate memory. |
| 1399 | } |
| 1400 | } |
| 1401 | |
| 1402 | /// @dev Returns the initialization code hash of the ERC1967I proxy of `implementation`. |
| 1403 | function initCodeHashERC1967I(address implementation) internal pure returns (bytes32 hash) { |
| 1404 | /// @solidity memory-safe-assembly |
| 1405 | assembly { |
| 1406 | let m := mload(0x40) // Cache the free memory pointer. |
| 1407 | mstore(0x60, 0x3d6000803e603e573d6000fd5b3d6000f35b6020600f3d393d51543d52593df3) |
| 1408 | mstore(0x40, 0xa13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc545af4) |
| 1409 | mstore(0x20, 0x600f5155f3365814604357363d3d373d3d363d7f360894) |
| 1410 | mstore(0x09, or(shl(160, 0x60523d8160223d3973), shr(96, shl(96, implementation)))) |
| 1411 | hash := keccak256(0x0c, 0x74) |
| 1412 | mstore(0x40, m) // Restore the free memory pointer. |
| 1413 | mstore(0x60, 0) // Restore the zero slot. |
| 1414 | } |
| 1415 | } |
| 1416 | |
| 1417 | /// @dev Returns the address of the ERC1967I proxy of `implementation`, with `salt` by `deployer`. |
| 1418 | /// Note: The returned result has dirty upper 96 bits. Please clean if used in assembly. |
| 1419 | function predictDeterministicAddressERC1967I( |
| 1420 | address implementation, |
| 1421 | bytes32 salt, |
| 1422 | address deployer |
| 1423 | ) internal pure returns (address predicted) { |
| 1424 | bytes32 hash = initCodeHashERC1967I(implementation); |
| 1425 | predicted = predictDeterministicAddress(hash, salt, deployer); |
| 1426 | } |
| 1427 | |
| 1428 | /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ |
| 1429 | /* ERC1967I PROXY WITH IMMUTABLE ARGS OPERATIONS */ |
| 1430 | /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ |
| 1431 | |
| 1432 | /// @dev Deploys a minimal ERC1967I proxy with `implementation` and `args`. |
| 1433 | function deployERC1967I(address implementation, bytes memory args) internal returns (address) { |
| 1434 | return deployERC1967I(0, implementation, args); |
| 1435 | } |
| 1436 | |
| 1437 | /// @dev Deploys a minimal ERC1967I proxy with `implementation` and `args`. |
| 1438 | /// Deposits `value` ETH during deployment. |
| 1439 | function deployERC1967I(uint256 value, address implementation, bytes memory args) |
| 1440 | internal |
| 1441 | returns (address instance) |
| 1442 | { |
| 1443 | /// @solidity memory-safe-assembly |
| 1444 | assembly { |
| 1445 | let m := mload(0x40) |
| 1446 | let n := mload(args) |
| 1447 | pop(staticcall(gas(), 4, add(args, 0x20), n, add(m, 0x8b), n)) |
| 1448 | |
| 1449 | mstore(add(m, 0x6b), 0x3d6000803e603e573d6000fd5b3d6000f35b6020600f3d393d51543d52593df3) |
| 1450 | mstore(add(m, 0x4b), 0xa13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc545af4) |
| 1451 | mstore(add(m, 0x2b), 0x600f5155f3365814604357363d3d373d3d363d7f360894) |
| 1452 | mstore(add(m, 0x14), implementation) |
| 1453 | mstore(m, add(0xfe6100523d8160233d3973, shl(56, n))) |
| 1454 | |
| 1455 | // Do a out-of-gas revert if `n` is greater than `0xffff - 0x52 = 0xffad`. |
| 1456 | instance := create(value, add(m, add(0x15, lt(n, 0xffae))), add(0x75, n)) |
| 1457 | if iszero(instance) { |
| 1458 | mstore(0x00, 0x30116425) // `DeploymentFailed()`. |
| 1459 | revert(0x1c, 0x04) |
| 1460 | } |
| 1461 | } |
| 1462 | } |
| 1463 | |
| 1464 | /// @dev Deploys a deterministic ERC1967I proxy with `implementation`, `args`, and `salt`. |
| 1465 | function deployDeterministicERC1967I(address implementation, bytes memory args, bytes32 salt) |
| 1466 | internal |
| 1467 | returns (address instance) |
| 1468 | { |
| 1469 | instance = deployDeterministicERC1967I(0, implementation, args, salt); |
| 1470 | } |
| 1471 | |
| 1472 | /// @dev Deploys a deterministic ERC1967I proxy with `implementation`, `args`, and `salt`. |
| 1473 | /// Deposits `value` ETH during deployment. |
| 1474 | function deployDeterministicERC1967I( |
| 1475 | uint256 value, |
| 1476 | address implementation, |
| 1477 | bytes memory args, |
| 1478 | bytes32 salt |
| 1479 | ) internal returns (address instance) { |
| 1480 | /// @solidity memory-safe-assembly |
| 1481 | assembly { |
| 1482 | let m := mload(0x40) |
| 1483 | let n := mload(args) |
| 1484 | pop(staticcall(gas(), 4, add(args, 0x20), n, add(m, 0x8b), n)) |
| 1485 | |
| 1486 | mstore(add(m, 0x6b), 0x3d6000803e603e573d6000fd5b3d6000f35b6020600f3d393d51543d52593df3) |
| 1487 | mstore(add(m, 0x4b), 0xa13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc545af4) |
| 1488 | mstore(add(m, 0x2b), 0x600f5155f3365814604357363d3d373d3d363d7f360894) |
| 1489 | mstore(add(m, 0x14), implementation) |
| 1490 | mstore(m, add(0xfe6100523d8160233d3973, shl(56, n))) |
| 1491 | |
| 1492 | // Do a out-of-gas revert if `n` is greater than `0xffff - 0x52 = 0xffad`. |
| 1493 | instance := create2(value, add(m, add(0x15, lt(n, 0xffae))), add(0x75, n), salt) |
| 1494 | if iszero(instance) { |
| 1495 | mstore(0x00, 0x30116425) // `DeploymentFailed()`. |
| 1496 | revert(0x1c, 0x04) |
| 1497 | } |
| 1498 | } |
| 1499 | } |
| 1500 | |
| 1501 | /// @dev Creates a deterministic ERC1967I proxy with `implementation`, `args` and `salt`. |
| 1502 | /// Note: This method is intended for use in ERC4337 factories, |
| 1503 | /// which are expected to NOT revert if the proxy is already deployed. |
| 1504 | function createDeterministicERC1967I(address implementation, bytes memory args, bytes32 salt) |
| 1505 | internal |
| 1506 | returns (bool alreadyDeployed, address instance) |
| 1507 | { |
| 1508 | return createDeterministicERC1967I(0, implementation, args, salt); |
| 1509 | } |
| 1510 | |
| 1511 | /// @dev Creates a deterministic ERC1967I proxy with `implementation`, `args` and `salt`. |
| 1512 | /// Deposits `value` ETH during deployment. |
| 1513 | /// Note: This method is intended for use in ERC4337 factories, |
| 1514 | /// which are expected to NOT revert if the proxy is already deployed. |
| 1515 | function createDeterministicERC1967I( |
| 1516 | uint256 value, |
| 1517 | address implementation, |
| 1518 | bytes memory args, |
| 1519 | bytes32 salt |
| 1520 | ) internal returns (bool alreadyDeployed, address instance) { |
| 1521 | /// @solidity memory-safe-assembly |
| 1522 | assembly { |
| 1523 | let m := mload(0x40) |
| 1524 | let n := mload(args) |
| 1525 | pop(staticcall(gas(), 4, add(args, 0x20), n, add(m, 0x75), n)) |
| 1526 | mstore(add(m, 0x55), 0x3d6000803e603e573d6000fd5b3d6000f35b6020600f3d393d51543d52593df3) |
| 1527 | mstore(add(m, 0x35), 0xa13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc545af4) |
| 1528 | mstore(add(m, 0x15), 0x5155f3365814604357363d3d373d3d363d7f360894) |
| 1529 | mstore(0x16, 0x600f) |
| 1530 | mstore(0x14, implementation) |
| 1531 | // Do a out-of-gas revert if `n` is greater than `0xffff - 0x52 = 0xffad`. |
| 1532 | mstore(gt(n, 0xffad), add(0xfe6100523d8160233d3973, shl(56, n))) |
| 1533 | mstore(m, mload(0x16)) |
| 1534 | // Compute and store the bytecode hash. |
| 1535 | mstore8(0x00, 0xff) // Write the prefix. |
| 1536 | mstore(0x35, keccak256(m, add(n, 0x75))) |
| 1537 | mstore(0x01, shl(96, address())) |
| 1538 | mstore(0x15, salt) |
| 1539 | instance := keccak256(0x00, 0x55) |
| 1540 | for {} 1 {} { |
| 1541 | if iszero(extcodesize(instance)) { |
| 1542 | instance := create2(value, m, add(0x75, n), salt) |
| 1543 | if iszero(instance) { |
| 1544 | mstore(0x00, 0x30116425) // `DeploymentFailed()`. |
| 1545 | revert(0x1c, 0x04) |
| 1546 | } |
| 1547 | break |
| 1548 | } |
| 1549 | alreadyDeployed := 1 |
| 1550 | if iszero(value) { break } |
| 1551 | if iszero(call(gas(), instance, value, codesize(), 0x00, codesize(), 0x00)) { |
| 1552 | mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`. |
| 1553 | revert(0x1c, 0x04) |
| 1554 | } |
| 1555 | break |
| 1556 | } |
| 1557 | mstore(0x35, 0) // Restore the overwritten part of the free memory pointer. |
| 1558 | } |
| 1559 | } |
| 1560 | |
| 1561 | /// @dev Returns the initialization code of the ERC1967I proxy of `implementation` and `args`. |
| 1562 | function initCodeERC1967I(address implementation, bytes memory args) |
| 1563 | internal |
| 1564 | pure |
| 1565 | returns (bytes memory c) |
| 1566 | { |
| 1567 | /// @solidity memory-safe-assembly |
| 1568 | assembly { |
| 1569 | c := mload(0x40) |
| 1570 | let n := mload(args) |
| 1571 | // Do a out-of-gas revert if `n` is greater than `0xffff - 0x52 = 0xffad`. |
| 1572 | returndatacopy(returndatasize(), returndatasize(), gt(n, 0xffad)) |
| 1573 | for { let i := 0 } lt(i, n) { i := add(i, 0x20) } { |
| 1574 | mstore(add(add(c, 0x95), i), mload(add(add(args, 0x20), i))) |
| 1575 | } |
| 1576 | |
| 1577 | mstore(add(c, 0x75), 0x3d6000803e603e573d6000fd5b3d6000f35b6020600f3d393d51543d52593df3) |
| 1578 | mstore(add(c, 0x55), 0xa13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc545af4) |
| 1579 | mstore(add(c, 0x35), 0x600f5155f3365814604357363d3d373d3d363d7f360894) |
| 1580 | mstore(add(c, 0x1e), implementation) |
| 1581 | mstore(add(c, 0x0a), add(0x6100523d8160233d3973, shl(56, n))) |
| 1582 | mstore(add(c, add(n, 0x95)), 0) |
| 1583 | mstore(c, add(0x75, n)) // Store the length. |
| 1584 | mstore(0x40, add(c, add(n, 0xb5))) // Allocate memory. |
| 1585 | } |
| 1586 | } |
| 1587 | |
| 1588 | /// @dev Returns the initialization code hash of the ERC1967I proxy of `implementation` and `args. |
| 1589 | function initCodeHashERC1967I(address implementation, bytes memory args) |
| 1590 | internal |
| 1591 | pure |
| 1592 | returns (bytes32 hash) |
| 1593 | { |
| 1594 | /// @solidity memory-safe-assembly |
| 1595 | assembly { |
| 1596 | let m := mload(0x40) // Cache the free memory pointer. |
| 1597 | let n := mload(args) |
| 1598 | // Do a out-of-gas revert if `n` is greater than `0xffff - 0x52 = 0xffad`. |
| 1599 | returndatacopy(returndatasize(), returndatasize(), gt(n, 0xffad)) |
| 1600 | |
| 1601 | for { let i := 0 } lt(i, n) { i := add(i, 0x20) } { |
| 1602 | mstore(add(add(m, 0x75), i), mload(add(add(args, 0x20), i))) |
| 1603 | } |
| 1604 | |
| 1605 | mstore(add(m, 0x55), 0x3d6000803e603e573d6000fd5b3d6000f35b6020600f3d393d51543d52593df3) |
| 1606 | mstore(add(m, 0x35), 0xa13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc545af4) |
| 1607 | mstore(add(m, 0x15), 0x5155f3365814604357363d3d373d3d363d7f360894) |
| 1608 | mstore(0x16, 0x600f) |
| 1609 | mstore(0x14, implementation) |
| 1610 | mstore(0x00, add(0x6100523d8160233d3973, shl(56, n))) |
| 1611 | mstore(m, mload(0x16)) |
| 1612 | hash := keccak256(m, add(0x75, n)) |
| 1613 | } |
| 1614 | } |
| 1615 | |
| 1616 | /// @dev Returns the address of the ERC1967I proxy of `implementation`, `args` with `salt` by `deployer`. |
| 1617 | /// Note: The returned result has dirty upper 96 bits. Please clean if used in assembly. |
| 1618 | function predictDeterministicAddressERC1967I( |
| 1619 | address implementation, |
| 1620 | bytes memory args, |
| 1621 | bytes32 salt, |
| 1622 | address deployer |
| 1623 | ) internal pure returns (address predicted) { |
| 1624 | bytes32 hash = initCodeHashERC1967I(implementation, args); |
| 1625 | predicted = predictDeterministicAddress(hash, salt, deployer); |
| 1626 | } |
| 1627 | |
| 1628 | /// @dev Equivalent to `argsOnERC1967I(instance, start, 2 ** 256 - 1)`. |
| 1629 | function argsOnERC1967I(address instance) internal view returns (bytes memory args) { |
| 1630 | /// @solidity memory-safe-assembly |
| 1631 | assembly { |
| 1632 | args := mload(0x40) |
| 1633 | mstore(args, and(0xffffffffff, sub(extcodesize(instance), 0x52))) // Store the length. |
| 1634 | extcodecopy(instance, add(args, 0x20), 0x52, add(mload(args), 0x20)) |
| 1635 | mstore(0x40, add(mload(args), add(args, 0x40))) // Allocate memory. |
| 1636 | } |
| 1637 | } |
| 1638 | |
| 1639 | /// @dev Equivalent to `argsOnERC1967I(instance, start, 2 ** 256 - 1)`. |
| 1640 | function argsOnERC1967I(address instance, uint256 start) |
| 1641 | internal |
| 1642 | view |
| 1643 | returns (bytes memory args) |
| 1644 | { |
| 1645 | /// @solidity memory-safe-assembly |
| 1646 | assembly { |
| 1647 | args := mload(0x40) |
| 1648 | let n := and(0xffffffffff, sub(extcodesize(instance), 0x52)) |
| 1649 | let l := sub(n, and(0xffffff, mul(lt(start, n), start))) |
| 1650 | extcodecopy(instance, args, add(start, 0x32), add(l, 0x40)) |
| 1651 | mstore(args, mul(sub(n, start), lt(start, n))) // Store the length. |
| 1652 | mstore(0x40, add(mload(args), add(args, 0x40))) // Allocate memory. |
| 1653 | } |
| 1654 | } |
| 1655 | |
| 1656 | /// @dev Returns a slice of the immutable arguments on `instance` from `start` to `end`. |
| 1657 | /// `start` and `end` will be clamped to the range `[0, args.length]`. |
| 1658 | /// The `instance` MUST be deployed via the ERC1967 with immutable args functions. |
| 1659 | /// Otherwise, the behavior is undefined. |
| 1660 | /// Out-of-gas reverts if `instance` does not have any code. |
| 1661 | function argsOnERC1967I(address instance, uint256 start, uint256 end) |
| 1662 | internal |
| 1663 | view |
| 1664 | returns (bytes memory args) |
| 1665 | { |
| 1666 | /// @solidity memory-safe-assembly |
| 1667 | assembly { |
| 1668 | args := mload(0x40) |
| 1669 | if iszero(lt(end, 0xffff)) { end := 0xffff } |
| 1670 | let d := mul(sub(end, start), lt(start, end)) |
| 1671 | extcodecopy(instance, args, add(start, 0x32), add(d, 0x20)) |
| 1672 | if iszero(and(0xff, mload(add(args, d)))) { |
| 1673 | let n := sub(extcodesize(instance), 0x52) |
| 1674 | returndatacopy(returndatasize(), returndatasize(), shr(40, n)) |
| 1675 | d := mul(gt(n, start), sub(d, mul(gt(end, n), sub(end, n)))) |
| 1676 | } |
| 1677 | mstore(args, d) // Store the length. |
| 1678 | mstore(add(add(args, 0x20), d), 0) // Zeroize the slot after the bytes. |
| 1679 | mstore(0x40, add(add(args, 0x40), d)) // Allocate memory. |
| 1680 | } |
| 1681 | } |
| 1682 | |
| 1683 | /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ |
| 1684 | /* ERC1967 BOOTSTRAP OPERATIONS */ |
| 1685 | /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ |
| 1686 | |
| 1687 | // A bootstrap is a minimal UUPS implementation that allows an ERC1967 proxy |
| 1688 | // pointing to it to be upgraded. The ERC1967 proxy can then be deployed to a |
| 1689 | // deterministic address independent of the implementation: |
| 1690 | // ``` |
| 1691 | // address bootstrap = LibClone.erc1967Bootstrap(); |
| 1692 | // address instance = LibClone.deployDeterministicERC1967(0, bootstrap, salt); |
| 1693 | // LibClone.bootstrapERC1967(bootstrap, implementation); |
| 1694 | // ``` |
| 1695 | |
| 1696 | /// @dev Deploys the ERC1967 bootstrap if it has not been deployed. |
| 1697 | function erc1967Bootstrap() internal returns (address) { |
| 1698 | return erc1967Bootstrap(address(this)); |
| 1699 | } |
| 1700 | |
| 1701 | /// @dev Deploys the ERC1967 bootstrap if it has not been deployed. |
| 1702 | function erc1967Bootstrap(address authorizedUpgrader) internal returns (address bootstrap) { |
| 1703 | bytes memory c = initCodeERC1967Bootstrap(authorizedUpgrader); |
| 1704 | bootstrap = predictDeterministicAddress(keccak256(c), bytes32(0), address(this)); |
| 1705 | /// @solidity memory-safe-assembly |
| 1706 | assembly { |
| 1707 | if iszero(extcodesize(bootstrap)) { |
| 1708 | if iszero(create2(0, add(c, 0x20), mload(c), 0)) { |
| 1709 | mstore(0x00, 0x30116425) // `DeploymentFailed()`. |
| 1710 | revert(0x1c, 0x04) |
| 1711 | } |
| 1712 | } |
| 1713 | } |
| 1714 | } |
| 1715 | |
| 1716 | /// @dev Replaces the implementation at `instance`. |
| 1717 | function bootstrapERC1967(address instance, address implementation) internal { |
| 1718 | /// @solidity memory-safe-assembly |
| 1719 | assembly { |
| 1720 | mstore(0x00, implementation) |
| 1721 | if iszero(call(gas(), instance, 0, 0x0c, 0x14, codesize(), 0x00)) { |
| 1722 | mstore(0x00, 0x30116425) // `DeploymentFailed()`. |
| 1723 | revert(0x1c, 0x04) |
| 1724 | } |
| 1725 | } |
| 1726 | } |
| 1727 | |
| 1728 | /// @dev Replaces the implementation at `instance`, and then call it with `data`. |
| 1729 | function bootstrapERC1967AndCall(address instance, address implementation, bytes memory data) |
| 1730 | internal |
| 1731 | { |
| 1732 | /// @solidity memory-safe-assembly |
| 1733 | assembly { |
| 1734 | let n := mload(data) |
| 1735 | mstore(data, implementation) |
| 1736 | if iszero(call(gas(), instance, 0, add(data, 0x0c), add(n, 0x14), codesize(), 0x00)) { |
| 1737 | if iszero(returndatasize()) { |
| 1738 | mstore(0x00, 0x30116425) // `DeploymentFailed()`. |
| 1739 | revert(0x1c, 0x04) |
| 1740 | } |
| 1741 | returndatacopy(mload(0x40), 0x00, returndatasize()) |
| 1742 | revert(mload(0x40), returndatasize()) |
| 1743 | } |
| 1744 | mstore(data, n) // Restore the length of `data`. |
| 1745 | } |
| 1746 | } |
| 1747 | |
| 1748 | /// @dev Returns the implementation address of the ERC1967 bootstrap for this contract. |
| 1749 | function predictDeterministicAddressERC1967Bootstrap() internal view returns (address) { |
| 1750 | return predictDeterministicAddressERC1967Bootstrap(address(this), address(this)); |
| 1751 | } |
| 1752 | |
| 1753 | /// @dev Returns the implementation address of the ERC1967 bootstrap for this contract. |
| 1754 | function predictDeterministicAddressERC1967Bootstrap( |
| 1755 | address authorizedUpgrader, |
| 1756 | address deployer |
| 1757 | ) internal pure returns (address) { |
| 1758 | bytes32 hash = initCodeHashERC1967Bootstrap(authorizedUpgrader); |
| 1759 | return predictDeterministicAddress(hash, bytes32(0), deployer); |
| 1760 | } |
| 1761 | |
| 1762 | /// @dev Returns the initialization code of the ERC1967 bootstrap. |
| 1763 | function initCodeERC1967Bootstrap(address authorizedUpgrader) |
| 1764 | internal |
| 1765 | pure |
| 1766 | returns (bytes memory c) |
| 1767 | { |
| 1768 | /// @solidity memory-safe-assembly |
| 1769 | assembly { |
| 1770 | c := mload(0x40) |
| 1771 | mstore(add(c, 0x80), 0x3d3560601c5af46047573d6000383e3d38fd0000000000000000000000000000) |
| 1772 | mstore(add(c, 0x60), 0xa920a3ca505d382bbc55601436116049575b005b363d3d373d3d601436036014) |
| 1773 | mstore(add(c, 0x40), 0x0338573d3560601c7f360894a13ba1a3210667c828492db98dca3e2076cc3735) |
| 1774 | mstore(add(c, 0x20), authorizedUpgrader) |
| 1775 | mstore(add(c, 0x0c), 0x606880600a3d393df3fe3373) |
| 1776 | mstore(c, 0x72) |
| 1777 | mstore(0x40, add(c, 0xa0)) |
| 1778 | } |
| 1779 | } |
| 1780 | |
| 1781 | /// @dev Returns the initialization code hash of the ERC1967 bootstrap. |
| 1782 | function initCodeHashERC1967Bootstrap(address authorizedUpgrader) |
| 1783 | internal |
| 1784 | pure |
| 1785 | returns (bytes32) |
| 1786 | { |
| 1787 | return keccak256(initCodeERC1967Bootstrap(authorizedUpgrader)); |
| 1788 | } |
| 1789 | |
| 1790 | /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ |
| 1791 | /* MINIMAL ERC1967 BEACON PROXY OPERATIONS */ |
| 1792 | /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ |
| 1793 | |
| 1794 | // Note: If you use this proxy, you MUST make sure that the beacon is a |
| 1795 | // valid ERC1967 beacon. This means that the beacon must always return a valid |
| 1796 | // address upon a staticcall to `implementation()`, given sufficient gas. |
| 1797 | // For performance, the deployment operations and the proxy assumes that the |
| 1798 | // beacon is always valid and will NOT validate it. |
| 1799 | |
| 1800 | /// @dev Deploys a minimal ERC1967 beacon proxy. |
| 1801 | function deployERC1967BeaconProxy(address beacon) internal returns (address instance) { |
| 1802 | instance = deployERC1967BeaconProxy(0, beacon); |
| 1803 | } |
| 1804 | |
| 1805 | /// @dev Deploys a minimal ERC1967 beacon proxy. |
| 1806 | /// Deposits `value` ETH during deployment. |
| 1807 | function deployERC1967BeaconProxy(uint256 value, address beacon) |
| 1808 | internal |
| 1809 | returns (address instance) |
| 1810 | { |
| 1811 | /// @solidity memory-safe-assembly |
| 1812 | assembly { |
| 1813 | /** |
| 1814 | * ---------------------------------------------------------------------------------+ |
| 1815 | * CREATION (34 bytes) | |
| 1816 | * ---------------------------------------------------------------------------------| |
| 1817 | * Opcode | Mnemonic | Stack | Memory | |
| 1818 | * ---------------------------------------------------------------------------------| |
| 1819 | * 60 runSize | PUSH1 runSize | r | | |
| 1820 | * 3d | RETURNDATASIZE | 0 r | | |
| 1821 | * 81 | DUP2 | r 0 r | | |
| 1822 | * 60 offset | PUSH1 offset | o r 0 r | | |
| 1823 | * 3d | RETURNDATASIZE | 0 o r 0 r | | |
| 1824 | * 39 | CODECOPY | 0 r | [0..runSize): runtime code | |
| 1825 | * 73 beac | PUSH20 beac | beac 0 r | [0..runSize): runtime code | |
| 1826 | * 60 slotPos | PUSH1 slotPos | slotPos beac 0 r | [0..runSize): runtime code | |
| 1827 | * 51 | MLOAD | slot beac 0 r | [0..runSize): runtime code | |
| 1828 | * 55 | SSTORE | 0 r | [0..runSize): runtime code | |
| 1829 | * f3 | RETURN | | [0..runSize): runtime code | |
| 1830 | * ---------------------------------------------------------------------------------| |
| 1831 | * RUNTIME (82 bytes) | |
| 1832 | * ---------------------------------------------------------------------------------| |
| 1833 | * Opcode | Mnemonic | Stack | Memory | |
| 1834 | * ---------------------------------------------------------------------------------| |
| 1835 | * | |
| 1836 | * ::: copy calldata to memory :::::::::::::::::::::::::::::::::::::::::::::::::::: | |
| 1837 | * 36 | CALLDATASIZE | cds | | |
| 1838 | * 3d | RETURNDATASIZE | 0 cds | | |
| 1839 | * 3d | RETURNDATASIZE | 0 0 cds | | |
| 1840 | * 37 | CALLDATACOPY | | [0..calldatasize): calldata | |
| 1841 | * | |
| 1842 | * ::: delegatecall to implementation ::::::::::::::::::::::::::::::::::::::::::::: | |
| 1843 | * 3d | RETURNDATASIZE | 0 | | |
| 1844 | * 3d | RETURNDATASIZE | 0 0 | | |
| 1845 | * 36 | CALLDATASIZE | cds 0 0 | [0..calldatasize): calldata | |
| 1846 | * 3d | RETURNDATASIZE | 0 cds 0 0 | [0..calldatasize): calldata | |
| 1847 | * | |
| 1848 | * ~~~~~~~ beacon staticcall sub procedure ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
| 1849 | * 60 0x20 | PUSH1 0x20 | 32 | | |
| 1850 | * 36 | CALLDATASIZE | cds 32 | | |
| 1851 | * 60 0x04 | PUSH1 0x04 | 4 cds 32 | | |
| 1852 | * 36 | CALLDATASIZE | cds 4 cds 32 | | |
| 1853 | * 63 0x5c60da1b | PUSH4 0x5c60da1b | 0x5c60da1b cds 4 cds 32 | | |
| 1854 | * 60 0xe0 | PUSH1 0xe0 | 224 0x5c60da1b cds 4 cds 32 | | |
| 1855 | * 1b | SHL | sel cds 4 cds 32 | | |
| 1856 | * 36 | CALLDATASIZE | cds sel cds 4 cds 32 | | |
| 1857 | * 52 | MSTORE | cds 4 cds 32 | sel | |
| 1858 | * 7f slot | PUSH32 slot | s cds 4 cds 32 | sel | |
| 1859 | * 54 | SLOAD | beac cds 4 cds 32 | sel | |
| 1860 | * 5a | GAS | g beac cds 4 cds 32 | sel | |
| 1861 | * fa | STATICCALL | succ | impl | |
| 1862 | * 50 | POP | | impl | |
| 1863 | * 36 | CALLDATASIZE | cds | impl | |
| 1864 | * 51 | MLOAD | impl | impl | |
| 1865 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
| 1866 | * 5a | GAS | g impl 0 cds 0 0 | [0..calldatasize): calldata | |
| 1867 | * f4 | DELEGATECALL | succ | [0..calldatasize): calldata | |
| 1868 | * | |
| 1869 | * ::: copy returndata to memory :::::::::::::::::::::::::::::::::::::::::::::::::: | |
| 1870 | * 3d | RETURNDATASIZE | rds succ | [0..calldatasize): calldata | |
| 1871 | * 60 0x00 | PUSH1 0x00 | 0 rds succ | [0..calldatasize): calldata | |
| 1872 | * 80 | DUP1 | 0 0 rds succ | [0..calldatasize): calldata | |
| 1873 | * 3e | RETURNDATACOPY | succ | [0..returndatasize): returndata | |
| 1874 | * | |
| 1875 | * ::: branch on delegatecall status :::::::::::::::::::::::::::::::::::::::::::::: | |
| 1876 | * 60 0x4d | PUSH1 0x4d | dest succ | [0..returndatasize): returndata | |
| 1877 | * 57 | JUMPI | | [0..returndatasize): returndata | |
| 1878 | * | |
| 1879 | * ::: delegatecall failed, revert :::::::::::::::::::::::::::::::::::::::::::::::: | |
| 1880 | * 3d | RETURNDATASIZE | rds | [0..returndatasize): returndata | |
| 1881 | * 60 0x00 | PUSH1 0x00 | 0 rds | [0..returndatasize): returndata | |
| 1882 | * fd | REVERT | | [0..returndatasize): returndata | |
| 1883 | * | |
| 1884 | * ::: delegatecall succeeded, return ::::::::::::::::::::::::::::::::::::::::::::: | |
| 1885 | * 5b | JUMPDEST | | [0..returndatasize): returndata | |
| 1886 | * 3d | RETURNDATASIZE | rds | [0..returndatasize): returndata | |
| 1887 | * 60 0x00 | PUSH1 0x00 | 0 rds | [0..returndatasize): returndata | |
| 1888 | * f3 | RETURN | | [0..returndatasize): returndata | |
| 1889 | * ---------------------------------------------------------------------------------+ |
| 1890 | */ |
| 1891 | let m := mload(0x40) // Cache the free memory pointer. |
| 1892 | mstore(0x60, 0xb3582b35133d50545afa5036515af43d6000803e604d573d6000fd5b3d6000f3) |
| 1893 | mstore(0x40, 0x1b60e01b36527fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6c) |
| 1894 | mstore(0x20, 0x60195155f3363d3d373d3d363d602036600436635c60da) |
| 1895 | mstore(0x09, or(shl(160, 0x60523d8160223d3973), shr(96, shl(96, beacon)))) |
| 1896 | instance := create(value, 0x0c, 0x74) |
| 1897 | if iszero(instance) { |
| 1898 | mstore(0x00, 0x30116425) // `DeploymentFailed()`. |
| 1899 | revert(0x1c, 0x04) |
| 1900 | } |
| 1901 | mstore(0x40, m) // Restore the free memory pointer. |
| 1902 | mstore(0x60, 0) // Restore the zero slot. |
| 1903 | } |
| 1904 | } |
| 1905 | |
| 1906 | /// @dev Deploys a deterministic minimal ERC1967 beacon proxy with `salt`. |
| 1907 | function deployDeterministicERC1967BeaconProxy(address beacon, bytes32 salt) |
| 1908 | internal |
| 1909 | returns (address instance) |
| 1910 | { |
| 1911 | instance = deployDeterministicERC1967BeaconProxy(0, beacon, salt); |
| 1912 | } |
| 1913 | |
| 1914 | /// @dev Deploys a deterministic minimal ERC1967 beacon proxy with `salt`. |
| 1915 | /// Deposits `value` ETH during deployment. |
| 1916 | function deployDeterministicERC1967BeaconProxy(uint256 value, address beacon, bytes32 salt) |
| 1917 | internal |
| 1918 | returns (address instance) |
| 1919 | { |
| 1920 | /// @solidity memory-safe-assembly |
| 1921 | assembly { |
| 1922 | let m := mload(0x40) // Cache the free memory pointer. |
| 1923 | mstore(0x60, 0xb3582b35133d50545afa5036515af43d6000803e604d573d6000fd5b3d6000f3) |
| 1924 | mstore(0x40, 0x1b60e01b36527fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6c) |
| 1925 | mstore(0x20, 0x60195155f3363d3d373d3d363d602036600436635c60da) |
| 1926 | mstore(0x09, or(shl(160, 0x60523d8160223d3973), shr(96, shl(96, beacon)))) |
| 1927 | instance := create2(value, 0x0c, 0x74, salt) |
| 1928 | if iszero(instance) { |
| 1929 | mstore(0x00, 0x30116425) // `DeploymentFailed()`. |
| 1930 | revert(0x1c, 0x04) |
| 1931 | } |
| 1932 | mstore(0x40, m) // Restore the free memory pointer. |
| 1933 | mstore(0x60, 0) // Restore the zero slot. |
| 1934 | } |
| 1935 | } |
| 1936 | |
| 1937 | /// @dev Creates a deterministic minimal ERC1967 beacon proxy with `salt`. |
| 1938 | /// Note: This method is intended for use in ERC4337 factories, |
| 1939 | /// which are expected to NOT revert if the proxy is already deployed. |
| 1940 | function createDeterministicERC1967BeaconProxy(address beacon, bytes32 salt) |
| 1941 | internal |
| 1942 | returns (bool alreadyDeployed, address instance) |
| 1943 | { |
| 1944 | return createDeterministicERC1967BeaconProxy(0, beacon, salt); |
| 1945 | } |
| 1946 | |
| 1947 | /// @dev Creates a deterministic minimal ERC1967 beacon proxy with `salt`. |
| 1948 | /// Deposits `value` ETH during deployment. |
| 1949 | /// Note: This method is intended for use in ERC4337 factories, |
| 1950 | /// which are expected to NOT revert if the proxy is already deployed. |
| 1951 | function createDeterministicERC1967BeaconProxy(uint256 value, address beacon, bytes32 salt) |
| 1952 | internal |
| 1953 | returns (bool alreadyDeployed, address instance) |
| 1954 | { |
| 1955 | /// @solidity memory-safe-assembly |
| 1956 | assembly { |
| 1957 | let m := mload(0x40) // Cache the free memory pointer. |
| 1958 | mstore(0x60, 0xb3582b35133d50545afa5036515af43d6000803e604d573d6000fd5b3d6000f3) |
| 1959 | mstore(0x40, 0x1b60e01b36527fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6c) |
| 1960 | mstore(0x20, 0x60195155f3363d3d373d3d363d602036600436635c60da) |
| 1961 | mstore(0x09, or(shl(160, 0x60523d8160223d3973), shr(96, shl(96, beacon)))) |
| 1962 | // Compute and store the bytecode hash. |
| 1963 | mstore(add(m, 0x35), keccak256(0x0c, 0x74)) |
| 1964 | mstore(m, shl(88, address())) |
| 1965 | mstore8(m, 0xff) // Write the prefix. |
| 1966 | mstore(add(m, 0x15), salt) |
| 1967 | instance := keccak256(m, 0x55) |
| 1968 | for {} 1 {} { |
| 1969 | if iszero(extcodesize(instance)) { |
| 1970 | instance := create2(value, 0x0c, 0x74, salt) |
| 1971 | if iszero(instance) { |
| 1972 | mstore(0x00, 0x30116425) // `DeploymentFailed()`. |
| 1973 | revert(0x1c, 0x04) |
| 1974 | } |
| 1975 | break |
| 1976 | } |
| 1977 | alreadyDeployed := 1 |
| 1978 | if iszero(value) { break } |
| 1979 | if iszero(call(gas(), instance, value, codesize(), 0x00, codesize(), 0x00)) { |
| 1980 | mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`. |
| 1981 | revert(0x1c, 0x04) |
| 1982 | } |
| 1983 | break |
| 1984 | } |
| 1985 | mstore(0x40, m) // Restore the free memory pointer. |
| 1986 | mstore(0x60, 0) // Restore the zero slot. |
| 1987 | } |
| 1988 | } |
| 1989 | |
| 1990 | /// @dev Returns the initialization code of the minimal ERC1967 beacon proxy. |
| 1991 | function initCodeERC1967BeaconProxy(address beacon) internal pure returns (bytes memory c) { |
| 1992 | /// @solidity memory-safe-assembly |
| 1993 | assembly { |
| 1994 | c := mload(0x40) |
| 1995 | mstore(add(c, 0x74), 0xb3582b35133d50545afa5036515af43d6000803e604d573d6000fd5b3d6000f3) |
| 1996 | mstore(add(c, 0x54), 0x1b60e01b36527fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6c) |
| 1997 | mstore(add(c, 0x34), 0x60195155f3363d3d373d3d363d602036600436635c60da) |
| 1998 | mstore(add(c, 0x1d), beacon) |
| 1999 | mstore(add(c, 0x09), 0x60523d8160223d3973) |
| 2000 | mstore(add(c, 0x94), 0) |
| 2001 | mstore(c, 0x74) // Store the length. |
| 2002 | mstore(0x40, add(c, 0xa0)) // Allocate memory. |
| 2003 | } |
| 2004 | } |
| 2005 | |
| 2006 | /// @dev Returns the initialization code hash of the minimal ERC1967 beacon proxy. |
| 2007 | function initCodeHashERC1967BeaconProxy(address beacon) internal pure returns (bytes32 hash) { |
| 2008 | /// @solidity memory-safe-assembly |
| 2009 | assembly { |
| 2010 | let m := mload(0x40) // Cache the free memory pointer. |
| 2011 | mstore(0x60, 0xb3582b35133d50545afa5036515af43d6000803e604d573d6000fd5b3d6000f3) |
| 2012 | mstore(0x40, 0x1b60e01b36527fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6c) |
| 2013 | mstore(0x20, 0x60195155f3363d3d373d3d363d602036600436635c60da) |
| 2014 | mstore(0x09, or(shl(160, 0x60523d8160223d3973), shr(96, shl(96, beacon)))) |
| 2015 | hash := keccak256(0x0c, 0x74) |
| 2016 | mstore(0x40, m) // Restore the free memory pointer. |
| 2017 | mstore(0x60, 0) // Restore the zero slot. |
| 2018 | } |
| 2019 | } |
| 2020 | |
| 2021 | /// @dev Returns the address of the ERC1967 beacon proxy, with `salt` by `deployer`. |
| 2022 | /// Note: The returned result has dirty upper 96 bits. Please clean if used in assembly. |
| 2023 | function predictDeterministicAddressERC1967BeaconProxy( |
| 2024 | address beacon, |
| 2025 | bytes32 salt, |
| 2026 | address deployer |
| 2027 | ) internal pure returns (address predicted) { |
| 2028 | bytes32 hash = initCodeHashERC1967BeaconProxy(beacon); |
| 2029 | predicted = predictDeterministicAddress(hash, salt, deployer); |
| 2030 | } |
| 2031 | |
| 2032 | /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ |
| 2033 | /* ERC1967 BEACON PROXY WITH IMMUTABLE ARGS OPERATIONS */ |
| 2034 | /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ |
| 2035 | |
| 2036 | /// @dev Deploys a minimal ERC1967 beacon proxy with `args`. |
| 2037 | function deployERC1967BeaconProxy(address beacon, bytes memory args) |
| 2038 | internal |
| 2039 | returns (address instance) |
| 2040 | { |
| 2041 | instance = deployERC1967BeaconProxy(0, beacon, args); |
| 2042 | } |
| 2043 | |
| 2044 | /// @dev Deploys a minimal ERC1967 beacon proxy with `args`. |
| 2045 | /// Deposits `value` ETH during deployment. |
| 2046 | function deployERC1967BeaconProxy(uint256 value, address beacon, bytes memory args) |
| 2047 | internal |
| 2048 | returns (address instance) |
| 2049 | { |
| 2050 | /// @solidity memory-safe-assembly |
| 2051 | assembly { |
| 2052 | let m := mload(0x40) |
| 2053 | let n := mload(args) |
| 2054 | pop(staticcall(gas(), 4, add(args, 0x20), n, add(m, 0x8b), n)) |
| 2055 | mstore(add(m, 0x6b), 0xb3582b35133d50545afa5036515af43d6000803e604d573d6000fd5b3d6000f3) |
| 2056 | mstore(add(m, 0x4b), 0x1b60e01b36527fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6c) |
| 2057 | mstore(add(m, 0x2b), 0x60195155f3363d3d373d3d363d602036600436635c60da) |
| 2058 | mstore(add(m, 0x14), beacon) |
| 2059 | // Do a out-of-gas revert if `n` is greater than `0xffff - 0x52 = 0xffad`. |
| 2060 | mstore(add(m, gt(n, 0xffad)), add(0xfe6100523d8160233d3973, shl(56, n))) |
| 2061 | instance := create(value, add(m, 0x16), add(n, 0x75)) |
| 2062 | if iszero(instance) { |
| 2063 | mstore(0x00, 0x30116425) // `DeploymentFailed()`. |
| 2064 | revert(0x1c, 0x04) |
| 2065 | } |
| 2066 | } |
| 2067 | } |
| 2068 | |
| 2069 | /// @dev Deploys a deterministic minimal ERC1967 beacon proxy with `args` and `salt`. |
| 2070 | function deployDeterministicERC1967BeaconProxy(address beacon, bytes memory args, bytes32 salt) |
| 2071 | internal |
| 2072 | returns (address instance) |
| 2073 | { |
| 2074 | instance = deployDeterministicERC1967BeaconProxy(0, beacon, args, salt); |
| 2075 | } |
| 2076 | |
| 2077 | /// @dev Deploys a deterministic minimal ERC1967 beacon proxy with `args` and `salt`. |
| 2078 | /// Deposits `value` ETH during deployment. |
| 2079 | function deployDeterministicERC1967BeaconProxy( |
| 2080 | uint256 value, |
| 2081 | address beacon, |
| 2082 | bytes memory args, |
| 2083 | bytes32 salt |
| 2084 | ) internal returns (address instance) { |
| 2085 | /// @solidity memory-safe-assembly |
| 2086 | assembly { |
| 2087 | let m := mload(0x40) |
| 2088 | let n := mload(args) |
| 2089 | pop(staticcall(gas(), 4, add(args, 0x20), n, add(m, 0x8b), n)) |
| 2090 | mstore(add(m, 0x6b), 0xb3582b35133d50545afa5036515af43d6000803e604d573d6000fd5b3d6000f3) |
| 2091 | mstore(add(m, 0x4b), 0x1b60e01b36527fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6c) |
| 2092 | mstore(add(m, 0x2b), 0x60195155f3363d3d373d3d363d602036600436635c60da) |
| 2093 | mstore(add(m, 0x14), beacon) |
| 2094 | // Do a out-of-gas revert if `n` is greater than `0xffff - 0x52 = 0xffad`. |
| 2095 | mstore(add(m, gt(n, 0xffad)), add(0xfe6100523d8160233d3973, shl(56, n))) |
| 2096 | instance := create2(value, add(m, 0x16), add(n, 0x75), salt) |
| 2097 | if iszero(instance) { |
| 2098 | mstore(0x00, 0x30116425) // `DeploymentFailed()`. |
| 2099 | revert(0x1c, 0x04) |
| 2100 | } |
| 2101 | } |
| 2102 | } |
| 2103 | |
| 2104 | /// @dev Creates a deterministic minimal ERC1967 beacon proxy with `args` and `salt`. |
| 2105 | /// Note: This method is intended for use in ERC4337 factories, |
| 2106 | /// which are expected to NOT revert if the proxy is already deployed. |
| 2107 | function createDeterministicERC1967BeaconProxy(address beacon, bytes memory args, bytes32 salt) |
| 2108 | internal |
| 2109 | returns (bool alreadyDeployed, address instance) |
| 2110 | { |
| 2111 | return createDeterministicERC1967BeaconProxy(0, beacon, args, salt); |
| 2112 | } |
| 2113 | |
| 2114 | /// @dev Creates a deterministic minimal ERC1967 beacon proxy with `args` and `salt`. |
| 2115 | /// Deposits `value` ETH during deployment. |
| 2116 | /// Note: This method is intended for use in ERC4337 factories, |
| 2117 | /// which are expected to NOT revert if the proxy is already deployed. |
| 2118 | function createDeterministicERC1967BeaconProxy( |
| 2119 | uint256 value, |
| 2120 | address beacon, |
| 2121 | bytes memory args, |
| 2122 | bytes32 salt |
| 2123 | ) internal returns (bool alreadyDeployed, address instance) { |
| 2124 | /// @solidity memory-safe-assembly |
| 2125 | assembly { |
| 2126 | let m := mload(0x40) |
| 2127 | let n := mload(args) |
| 2128 | pop(staticcall(gas(), 4, add(args, 0x20), n, add(m, 0x8b), n)) |
| 2129 | mstore(add(m, 0x6b), 0xb3582b35133d50545afa5036515af43d6000803e604d573d6000fd5b3d6000f3) |
| 2130 | mstore(add(m, 0x4b), 0x1b60e01b36527fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6c) |
| 2131 | mstore(add(m, 0x2b), 0x60195155f3363d3d373d3d363d602036600436635c60da) |
| 2132 | mstore(add(m, 0x14), beacon) |
| 2133 | // Do a out-of-gas revert if `n` is greater than `0xffff - 0x52 = 0xffad`. |
| 2134 | mstore(add(m, gt(n, 0xffad)), add(0xfe6100523d8160233d3973, shl(56, n))) |
| 2135 | // Compute and store the bytecode hash. |
| 2136 | mstore8(0x00, 0xff) // Write the prefix. |
| 2137 | mstore(0x35, keccak256(add(m, 0x16), add(n, 0x75))) |
| 2138 | mstore(0x01, shl(96, address())) |
| 2139 | mstore(0x15, salt) |
| 2140 | instance := keccak256(0x00, 0x55) |
| 2141 | for {} 1 {} { |
| 2142 | if iszero(extcodesize(instance)) { |
| 2143 | instance := create2(value, add(m, 0x16), add(n, 0x75), salt) |
| 2144 | if iszero(instance) { |
| 2145 | mstore(0x00, 0x30116425) // `DeploymentFailed()`. |
| 2146 | revert(0x1c, 0x04) |
| 2147 | } |
| 2148 | break |
| 2149 | } |
| 2150 | alreadyDeployed := 1 |
| 2151 | if iszero(value) { break } |
| 2152 | if iszero(call(gas(), instance, value, codesize(), 0x00, codesize(), 0x00)) { |
| 2153 | mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`. |
| 2154 | revert(0x1c, 0x04) |
| 2155 | } |
| 2156 | break |
| 2157 | } |
| 2158 | mstore(0x35, 0) // Restore the overwritten part of the free memory pointer. |
| 2159 | } |
| 2160 | } |
| 2161 | |
| 2162 | /// @dev Returns the initialization code of the minimal ERC1967 beacon proxy. |
| 2163 | function initCodeERC1967BeaconProxy(address beacon, bytes memory args) |
| 2164 | internal |
| 2165 | pure |
| 2166 | returns (bytes memory c) |
| 2167 | { |
| 2168 | /// @solidity memory-safe-assembly |
| 2169 | assembly { |
| 2170 | c := mload(0x40) |
| 2171 | let n := mload(args) |
| 2172 | // Do a out-of-gas revert if `n` is greater than `0xffff - 0x52 = 0xffad`. |
| 2173 | returndatacopy(returndatasize(), returndatasize(), gt(n, 0xffad)) |
| 2174 | for { let i := 0 } lt(i, n) { i := add(i, 0x20) } { |
| 2175 | mstore(add(add(c, 0x95), i), mload(add(add(args, 0x20), i))) |
| 2176 | } |
| 2177 | mstore(add(c, 0x75), 0xb3582b35133d50545afa5036515af43d6000803e604d573d6000fd5b3d6000f3) |
| 2178 | mstore(add(c, 0x55), 0x1b60e01b36527fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6c) |
| 2179 | mstore(add(c, 0x35), 0x60195155f3363d3d373d3d363d602036600436635c60da) |
| 2180 | mstore(add(c, 0x1e), beacon) |
| 2181 | mstore(add(c, 0x0a), add(0x6100523d8160233d3973, shl(56, n))) |
| 2182 | mstore(c, add(n, 0x75)) // Store the length. |
| 2183 | mstore(add(c, add(n, 0x95)), 0) // Zeroize the slot after the bytes. |
| 2184 | mstore(0x40, add(c, add(n, 0xb5))) // Allocate memory. |
| 2185 | } |
| 2186 | } |
| 2187 | |
| 2188 | /// @dev Returns the initialization code hash of the minimal ERC1967 beacon proxy with `args`. |
| 2189 | function initCodeHashERC1967BeaconProxy(address beacon, bytes memory args) |
| 2190 | internal |
| 2191 | pure |
| 2192 | returns (bytes32 hash) |
| 2193 | { |
| 2194 | /// @solidity memory-safe-assembly |
| 2195 | assembly { |
| 2196 | let m := mload(0x40) |
| 2197 | let n := mload(args) |
| 2198 | // Do a out-of-gas revert if `n` is greater than `0xffff - 0x52 = 0xffad`. |
| 2199 | returndatacopy(returndatasize(), returndatasize(), gt(n, 0xffad)) |
| 2200 | for { let i := 0 } lt(i, n) { i := add(i, 0x20) } { |
| 2201 | mstore(add(add(m, 0x8b), i), mload(add(add(args, 0x20), i))) |
| 2202 | } |
| 2203 | mstore(add(m, 0x6b), 0xb3582b35133d50545afa5036515af43d6000803e604d573d6000fd5b3d6000f3) |
| 2204 | mstore(add(m, 0x4b), 0x1b60e01b36527fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6c) |
| 2205 | mstore(add(m, 0x2b), 0x60195155f3363d3d373d3d363d602036600436635c60da) |
| 2206 | mstore(add(m, 0x14), beacon) |
| 2207 | mstore(m, add(0x6100523d8160233d3973, shl(56, n))) |
| 2208 | hash := keccak256(add(m, 0x16), add(n, 0x75)) |
| 2209 | } |
| 2210 | } |
| 2211 | |
| 2212 | /// @dev Returns the address of the ERC1967 beacon proxy with `args`, with `salt` by `deployer`. |
| 2213 | /// Note: The returned result has dirty upper 96 bits. Please clean if used in assembly. |
| 2214 | function predictDeterministicAddressERC1967BeaconProxy( |
| 2215 | address beacon, |
| 2216 | bytes memory args, |
| 2217 | bytes32 salt, |
| 2218 | address deployer |
| 2219 | ) internal pure returns (address predicted) { |
| 2220 | bytes32 hash = initCodeHashERC1967BeaconProxy(beacon, args); |
| 2221 | predicted = predictDeterministicAddress(hash, salt, deployer); |
| 2222 | } |
| 2223 | |
| 2224 | /// @dev Equivalent to `argsOnERC1967BeaconProxy(instance, start, 2 ** 256 - 1)`. |
| 2225 | function argsOnERC1967BeaconProxy(address instance) internal view returns (bytes memory args) { |
| 2226 | /// @solidity memory-safe-assembly |
| 2227 | assembly { |
| 2228 | args := mload(0x40) |
| 2229 | mstore(args, and(0xffffffffff, sub(extcodesize(instance), 0x52))) // Store the length. |
| 2230 | extcodecopy(instance, add(args, 0x20), 0x52, add(mload(args), 0x20)) |
| 2231 | mstore(0x40, add(mload(args), add(args, 0x40))) // Allocate memory. |
| 2232 | } |
| 2233 | } |
| 2234 | |
| 2235 | /// @dev Equivalent to `argsOnERC1967BeaconProxy(instance, start, 2 ** 256 - 1)`. |
| 2236 | function argsOnERC1967BeaconProxy(address instance, uint256 start) |
| 2237 | internal |
| 2238 | view |
| 2239 | returns (bytes memory args) |
| 2240 | { |
| 2241 | /// @solidity memory-safe-assembly |
| 2242 | assembly { |
| 2243 | args := mload(0x40) |
| 2244 | let n := and(0xffffffffff, sub(extcodesize(instance), 0x52)) |
| 2245 | let l := sub(n, and(0xffffff, mul(lt(start, n), start))) |
| 2246 | extcodecopy(instance, args, add(start, 0x32), add(l, 0x40)) |
| 2247 | mstore(args, mul(sub(n, start), lt(start, n))) // Store the length. |
| 2248 | mstore(0x40, add(args, add(0x40, mload(args)))) // Allocate memory. |
| 2249 | } |
| 2250 | } |
| 2251 | |
| 2252 | /// @dev Returns a slice of the immutable arguments on `instance` from `start` to `end`. |
| 2253 | /// `start` and `end` will be clamped to the range `[0, args.length]`. |
| 2254 | /// The `instance` MUST be deployed via the ERC1967 beacon proxy with immutable args functions. |
| 2255 | /// Otherwise, the behavior is undefined. |
| 2256 | /// Out-of-gas reverts if `instance` does not have any code. |
| 2257 | function argsOnERC1967BeaconProxy(address instance, uint256 start, uint256 end) |
| 2258 | internal |
| 2259 | view |
| 2260 | returns (bytes memory args) |
| 2261 | { |
| 2262 | /// @solidity memory-safe-assembly |
| 2263 | assembly { |
| 2264 | args := mload(0x40) |
| 2265 | if iszero(lt(end, 0xffff)) { end := 0xffff } |
| 2266 | let d := mul(sub(end, start), lt(start, end)) |
| 2267 | extcodecopy(instance, args, add(start, 0x32), add(d, 0x20)) |
| 2268 | if iszero(and(0xff, mload(add(args, d)))) { |
| 2269 | let n := sub(extcodesize(instance), 0x52) |
| 2270 | returndatacopy(returndatasize(), returndatasize(), shr(40, n)) |
| 2271 | d := mul(gt(n, start), sub(d, mul(gt(end, n), sub(end, n)))) |
| 2272 | } |
| 2273 | mstore(args, d) // Store the length. |
| 2274 | mstore(add(add(args, 0x20), d), 0) // Zeroize the slot after the bytes. |
| 2275 | mstore(0x40, add(add(args, 0x40), d)) // Allocate memory. |
| 2276 | } |
| 2277 | } |
| 2278 | |
| 2279 | /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ |
| 2280 | /* ERC1967I BEACON PROXY OPERATIONS */ |
| 2281 | /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ |
| 2282 | |
| 2283 | // Note: This proxy has a special code path that activates if `calldatasize() == 1`. |
| 2284 | // This code path skips the delegatecall and directly returns the `implementation` address. |
| 2285 | // The returned implementation is guaranteed to be valid if the keccak256 of the |
| 2286 | // proxy's code is equal to `ERC1967_BEACON_PROXY_CODE_HASH`. |
| 2287 | // |
| 2288 | // If you use this proxy, you MUST make sure that the beacon is a |
| 2289 | // valid ERC1967 beacon. This means that the beacon must always return a valid |
| 2290 | // address upon a staticcall to `implementation()`, given sufficient gas. |
| 2291 | // For performance, the deployment operations and the proxy assumes that the |
| 2292 | // beacon is always valid and will NOT validate it. |
| 2293 | |
| 2294 | /// @dev Deploys a ERC1967I beacon proxy. |
| 2295 | function deployERC1967IBeaconProxy(address beacon) internal returns (address instance) { |
| 2296 | instance = deployERC1967IBeaconProxy(0, beacon); |
| 2297 | } |
| 2298 | |
| 2299 | /// @dev Deploys a ERC1967I beacon proxy. |
| 2300 | /// Deposits `value` ETH during deployment. |
| 2301 | function deployERC1967IBeaconProxy(uint256 value, address beacon) |
| 2302 | internal |
| 2303 | returns (address instance) |
| 2304 | { |
| 2305 | /// @solidity memory-safe-assembly |
| 2306 | assembly { |
| 2307 | /** |
| 2308 | * ---------------------------------------------------------------------------------+ |
| 2309 | * CREATION (34 bytes) | |
| 2310 | * ---------------------------------------------------------------------------------| |
| 2311 | * Opcode | Mnemonic | Stack | Memory | |
| 2312 | * ---------------------------------------------------------------------------------| |
| 2313 | * 60 runSize | PUSH1 runSize | r | | |
| 2314 | * 3d | RETURNDATASIZE | 0 r | | |
| 2315 | * 81 | DUP2 | r 0 r | | |
| 2316 | * 60 offset | PUSH1 offset | o r 0 r | | |
| 2317 | * 3d | RETURNDATASIZE | 0 o r 0 r | | |
| 2318 | * 39 | CODECOPY | 0 r | [0..runSize): runtime code | |
| 2319 | * 73 beac | PUSH20 beac | beac 0 r | [0..runSize): runtime code | |
| 2320 | * 60 slotPos | PUSH1 slotPos | slotPos beac 0 r | [0..runSize): runtime code | |
| 2321 | * 51 | MLOAD | slot beac 0 r | [0..runSize): runtime code | |
| 2322 | * 55 | SSTORE | 0 r | [0..runSize): runtime code | |
| 2323 | * f3 | RETURN | | [0..runSize): runtime code | |
| 2324 | * ---------------------------------------------------------------------------------| |
| 2325 | * RUNTIME (87 bytes) | |
| 2326 | * ---------------------------------------------------------------------------------| |
| 2327 | * Opcode | Mnemonic | Stack | Memory | |
| 2328 | * ---------------------------------------------------------------------------------| |
| 2329 | * | |
| 2330 | * ::: copy calldata to memory :::::::::::::::::::::::::::::::::::::::::::::::::::: | |
| 2331 | * 36 | CALLDATASIZE | cds | | |
| 2332 | * 3d | RETURNDATASIZE | 0 cds | | |
| 2333 | * 3d | RETURNDATASIZE | 0 0 cds | | |
| 2334 | * 37 | CALLDATACOPY | | [0..calldatasize): calldata | |
| 2335 | * | |
| 2336 | * ::: delegatecall to implementation ::::::::::::::::::::::::::::::::::::::::::::: | |
| 2337 | * 3d | RETURNDATASIZE | 0 | | |
| 2338 | * 3d | RETURNDATASIZE | 0 0 | | |
| 2339 | * 36 | CALLDATASIZE | cds 0 0 | [0..calldatasize): calldata | |
| 2340 | * 3d | RETURNDATASIZE | 0 cds 0 0 | [0..calldatasize): calldata | |
| 2341 | * | |
| 2342 | * ~~~~~~~ beacon staticcall sub procedure ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
| 2343 | * 60 0x20 | PUSH1 0x20 | 32 | | |
| 2344 | * 36 | CALLDATASIZE | cds 32 | | |
| 2345 | * 60 0x04 | PUSH1 0x04 | 4 cds 32 | | |
| 2346 | * 36 | CALLDATASIZE | cds 4 cds 32 | | |
| 2347 | * 63 0x5c60da1b | PUSH4 0x5c60da1b | 0x5c60da1b cds 4 cds 32 | | |
| 2348 | * 60 0xe0 | PUSH1 0xe0 | 224 0x5c60da1b cds 4 cds 32 | | |
| 2349 | * 1b | SHL | sel cds 4 cds 32 | | |
| 2350 | * 36 | CALLDATASIZE | cds sel cds 4 cds 32 | | |
| 2351 | * 52 | MSTORE | cds 4 cds 32 | sel | |
| 2352 | * 7f slot | PUSH32 slot | s cds 4 cds 32 | sel | |
| 2353 | * 54 | SLOAD | beac cds 4 cds 32 | sel | |
| 2354 | * 5a | GAS | g beac cds 4 cds 32 | sel | |
| 2355 | * fa | STATICCALL | succ | impl | |
| 2356 | * ~~~~~~ check calldatasize ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
| 2357 | * 36 | CALLDATASIZE | cds succ | | |
| 2358 | * 14 | EQ | | impl | |
| 2359 | * 60 0x52 | PUSH1 0x52 | | impl | |
| 2360 | * 57 | JUMPI | | impl | |
| 2361 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
| 2362 | * 36 | CALLDATASIZE | cds | impl | |
| 2363 | * 51 | MLOAD | impl | impl | |
| 2364 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
| 2365 | * 5a | GAS | g impl 0 cds 0 0 | [0..calldatasize): calldata | |
| 2366 | * f4 | DELEGATECALL | succ | [0..calldatasize): calldata | |
| 2367 | * | |
| 2368 | * ::: copy returndata to memory :::::::::::::::::::::::::::::::::::::::::::::::::: | |
| 2369 | * 3d | RETURNDATASIZE | rds succ | [0..calldatasize): calldata | |
| 2370 | * 60 0x00 | PUSH1 0x00 | 0 rds succ | [0..calldatasize): calldata | |
| 2371 | * 60 0x01 | PUSH1 0x01 | 1 0 rds succ | [0..calldatasize): calldata | |
| 2372 | * 3e | RETURNDATACOPY | succ | [1..returndatasize): returndata | |
| 2373 | * | |
| 2374 | * ::: branch on delegatecall status :::::::::::::::::::::::::::::::::::::::::::::: | |
| 2375 | * 60 0x52 | PUSH1 0x52 | dest succ | [1..returndatasize): returndata | |
| 2376 | * 57 | JUMPI | | [1..returndatasize): returndata | |
| 2377 | * | |
| 2378 | * ::: delegatecall failed, revert :::::::::::::::::::::::::::::::::::::::::::::::: | |
| 2379 | * 3d | RETURNDATASIZE | rds | [1..returndatasize): returndata | |
| 2380 | * 60 0x01 | PUSH1 0x01 | 1 rds | [1..returndatasize): returndata | |
| 2381 | * fd | REVERT | | [1..returndatasize): returndata | |
| 2382 | * | |
| 2383 | * ::: delegatecall succeeded, return ::::::::::::::::::::::::::::::::::::::::::::: | |
| 2384 | * 5b | JUMPDEST | | [1..returndatasize): returndata | |
| 2385 | * 3d | RETURNDATASIZE | rds | [1..returndatasize): returndata | |
| 2386 | * 60 0x01 | PUSH1 0x01 | 1 rds | [1..returndatasize): returndata | |
| 2387 | * f3 | RETURN | | [1..returndatasize): returndata | |
| 2388 | * ---------------------------------------------------------------------------------+ |
| 2389 | */ |
| 2390 | let m := mload(0x40) // Cache the free memory pointer. |
| 2391 | mstore(0x60, 0x3d50545afa361460525736515af43d600060013e6052573d6001fd5b3d6001f3) |
| 2392 | mstore(0x40, 0x527fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b3513) |
| 2393 | mstore(0x20, 0x60195155f3363d3d373d3d363d602036600436635c60da1b60e01b36) |
| 2394 | mstore(0x04, or(shl(160, 0x60573d8160223d3973), shr(96, shl(96, beacon)))) |
| 2395 | instance := create(value, 0x07, 0x79) |
| 2396 | if iszero(instance) { |
| 2397 | mstore(0x00, 0x30116425) // `DeploymentFailed()`. |
| 2398 | revert(0x1c, 0x04) |
| 2399 | } |
| 2400 | mstore(0x40, m) // Restore the free memory pointer. |
| 2401 | mstore(0x60, 0) // Restore the zero slot. |
| 2402 | } |
| 2403 | } |
| 2404 | |
| 2405 | /// @dev Deploys a deterministic ERC1967I beacon proxy with `salt`. |
| 2406 | function deployDeterministicERC1967IBeaconProxy(address beacon, bytes32 salt) |
| 2407 | internal |
| 2408 | returns (address instance) |
| 2409 | { |
| 2410 | instance = deployDeterministicERC1967IBeaconProxy(0, beacon, salt); |
| 2411 | } |
| 2412 | |
| 2413 | /// @dev Deploys a deterministic ERC1967I beacon proxy with `salt`. |
| 2414 | /// Deposits `value` ETH during deployment. |
| 2415 | function deployDeterministicERC1967IBeaconProxy(uint256 value, address beacon, bytes32 salt) |
| 2416 | internal |
| 2417 | returns (address instance) |
| 2418 | { |
| 2419 | /// @solidity memory-safe-assembly |
| 2420 | assembly { |
| 2421 | let m := mload(0x40) // Cache the free memory pointer. |
| 2422 | mstore(0x60, 0x3d50545afa361460525736515af43d600060013e6052573d6001fd5b3d6001f3) |
| 2423 | mstore(0x40, 0x527fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b3513) |
| 2424 | mstore(0x20, 0x60195155f3363d3d373d3d363d602036600436635c60da1b60e01b36) |
| 2425 | mstore(0x04, or(shl(160, 0x60573d8160223d3973), shr(96, shl(96, beacon)))) |
| 2426 | instance := create2(value, 0x07, 0x79, salt) |
| 2427 | if iszero(instance) { |
| 2428 | mstore(0x00, 0x30116425) // `DeploymentFailed()`. |
| 2429 | revert(0x1c, 0x04) |
| 2430 | } |
| 2431 | mstore(0x40, m) // Restore the free memory pointer. |
| 2432 | mstore(0x60, 0) // Restore the zero slot. |
| 2433 | } |
| 2434 | } |
| 2435 | |
| 2436 | /// @dev Creates a deterministic ERC1967I beacon proxy with `salt`. |
| 2437 | /// Note: This method is intended for use in ERC4337 factories, |
| 2438 | /// which are expected to NOT revert if the proxy is already deployed. |
| 2439 | function createDeterministicERC1967IBeaconProxy(address beacon, bytes32 salt) |
| 2440 | internal |
| 2441 | returns (bool alreadyDeployed, address instance) |
| 2442 | { |
| 2443 | return createDeterministicERC1967IBeaconProxy(0, beacon, salt); |
| 2444 | } |
| 2445 | |
| 2446 | /// @dev Creates a deterministic ERC1967I beacon proxy with `salt`. |
| 2447 | /// Deposits `value` ETH during deployment. |
| 2448 | /// Note: This method is intended for use in ERC4337 factories, |
| 2449 | /// which are expected to NOT revert if the proxy is already deployed. |
| 2450 | function createDeterministicERC1967IBeaconProxy(uint256 value, address beacon, bytes32 salt) |
| 2451 | internal |
| 2452 | returns (bool alreadyDeployed, address instance) |
| 2453 | { |
| 2454 | /// @solidity memory-safe-assembly |
| 2455 | assembly { |
| 2456 | let m := mload(0x40) // Cache the free memory pointer. |
| 2457 | mstore(0x60, 0x3d50545afa361460525736515af43d600060013e6052573d6001fd5b3d6001f3) |
| 2458 | mstore(0x40, 0x527fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b3513) |
| 2459 | mstore(0x20, 0x60195155f3363d3d373d3d363d602036600436635c60da1b60e01b36) |
| 2460 | mstore(0x04, or(shl(160, 0x60573d8160223d3973), shr(96, shl(96, beacon)))) |
| 2461 | // Compute and store the bytecode hash. |
| 2462 | mstore(add(m, 0x35), keccak256(0x07, 0x79)) |
| 2463 | mstore(m, shl(88, address())) |
| 2464 | mstore8(m, 0xff) // Write the prefix. |
| 2465 | mstore(add(m, 0x15), salt) |
| 2466 | instance := keccak256(m, 0x55) |
| 2467 | for {} 1 {} { |
| 2468 | if iszero(extcodesize(instance)) { |
| 2469 | instance := create2(value, 0x07, 0x79, salt) |
| 2470 | if iszero(instance) { |
| 2471 | mstore(0x00, 0x30116425) // `DeploymentFailed()`. |
| 2472 | revert(0x1c, 0x04) |
| 2473 | } |
| 2474 | break |
| 2475 | } |
| 2476 | alreadyDeployed := 1 |
| 2477 | if iszero(value) { break } |
| 2478 | if iszero(call(gas(), instance, value, codesize(), 0x00, codesize(), 0x00)) { |
| 2479 | mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`. |
| 2480 | revert(0x1c, 0x04) |
| 2481 | } |
| 2482 | break |
| 2483 | } |
| 2484 | mstore(0x40, m) // Restore the free memory pointer. |
| 2485 | mstore(0x60, 0) // Restore the zero slot. |
| 2486 | } |
| 2487 | } |
| 2488 | |
| 2489 | /// @dev Returns the initialization code of the ERC1967I beacon proxy. |
| 2490 | function initCodeERC1967IBeaconProxy(address beacon) internal pure returns (bytes memory c) { |
| 2491 | /// @solidity memory-safe-assembly |
| 2492 | assembly { |
| 2493 | c := mload(0x40) |
| 2494 | mstore(add(c, 0x79), 0x3d50545afa361460525736515af43d600060013e6052573d6001fd5b3d6001f3) |
| 2495 | mstore(add(c, 0x59), 0x527fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b3513) |
| 2496 | mstore(add(c, 0x39), 0x60195155f3363d3d373d3d363d602036600436635c60da1b60e01b36) |
| 2497 | mstore(add(c, 0x1d), beacon) |
| 2498 | mstore(add(c, 0x09), 0x60573d8160223d3973) |
| 2499 | mstore(add(c, 0x99), 0) |
| 2500 | mstore(c, 0x79) // Store the length. |
| 2501 | mstore(0x40, add(c, 0xa0)) // Allocate memory. |
| 2502 | } |
| 2503 | } |
| 2504 | |
| 2505 | /// @dev Returns the initialization code hash of the ERC1967I beacon proxy. |
| 2506 | function initCodeHashERC1967IBeaconProxy(address beacon) internal pure returns (bytes32 hash) { |
| 2507 | /// @solidity memory-safe-assembly |
| 2508 | assembly { |
| 2509 | let m := mload(0x40) // Cache the free memory pointer. |
| 2510 | mstore(0x60, 0x3d50545afa361460525736515af43d600060013e6052573d6001fd5b3d6001f3) |
| 2511 | mstore(0x40, 0x527fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b3513) |
| 2512 | mstore(0x20, 0x60195155f3363d3d373d3d363d602036600436635c60da1b60e01b36) |
| 2513 | mstore(0x04, or(shl(160, 0x60573d8160223d3973), shr(96, shl(96, beacon)))) |
| 2514 | hash := keccak256(0x07, 0x79) |
| 2515 | mstore(0x40, m) // Restore the free memory pointer. |
| 2516 | mstore(0x60, 0) // Restore the zero slot. |
| 2517 | } |
| 2518 | } |
| 2519 | |
| 2520 | /// @dev Returns the address of the ERC1967I beacon proxy, with `salt` by `deployer`. |
| 2521 | /// Note: The returned result has dirty upper 96 bits. Please clean if used in assembly. |
| 2522 | function predictDeterministicAddressERC1967IBeaconProxy( |
| 2523 | address beacon, |
| 2524 | bytes32 salt, |
| 2525 | address deployer |
| 2526 | ) internal pure returns (address predicted) { |
| 2527 | bytes32 hash = initCodeHashERC1967IBeaconProxy(beacon); |
| 2528 | predicted = predictDeterministicAddress(hash, salt, deployer); |
| 2529 | } |
| 2530 | |
| 2531 | /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ |
| 2532 | /* ERC1967I BEACON PROXY WITH IMMUTABLE ARGS OPERATIONS */ |
| 2533 | /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ |
| 2534 | |
| 2535 | /// @dev Deploys a ERC1967I beacon proxy with `args. |
| 2536 | function deployERC1967IBeaconProxy(address beacon, bytes memory args) |
| 2537 | internal |
| 2538 | returns (address instance) |
| 2539 | { |
| 2540 | instance = deployERC1967IBeaconProxy(0, beacon, args); |
| 2541 | } |
| 2542 | |
| 2543 | /// @dev Deploys a ERC1967I beacon proxy with `args. |
| 2544 | /// Deposits `value` ETH during deployment. |
| 2545 | function deployERC1967IBeaconProxy(uint256 value, address beacon, bytes memory args) |
| 2546 | internal |
| 2547 | returns (address instance) |
| 2548 | { |
| 2549 | /// @solidity memory-safe-assembly |
| 2550 | assembly { |
| 2551 | let m := mload(0x40) // Cache the free memory pointer. |
| 2552 | let n := mload(args) |
| 2553 | pop(staticcall(gas(), 4, add(args, 0x20), n, add(m, 0x90), n)) |
| 2554 | mstore(add(m, 0x70), 0x3d50545afa361460525736515af43d600060013e6052573d6001fd5b3d6001f3) |
| 2555 | mstore(add(m, 0x50), 0x527fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b3513) |
| 2556 | mstore(add(m, 0x30), 0x60195155f3363d3d373d3d363d602036600436635c60da1b60e01b36) |
| 2557 | mstore(add(m, 0x14), beacon) |
| 2558 | // Do a out-of-gas revert if `n` is greater than `0xffff - 0x57 = 0xffa8`. |
| 2559 | mstore(add(m, gt(n, 0xffa8)), add(0xfe6100573d8160233d3973, shl(56, n))) |
| 2560 | instance := create(value, add(m, 0x16), add(n, 0x7a)) |
| 2561 | if iszero(instance) { |
| 2562 | mstore(0x00, 0x30116425) // `DeploymentFailed()`. |
| 2563 | revert(0x1c, 0x04) |
| 2564 | } |
| 2565 | } |
| 2566 | } |
| 2567 | |
| 2568 | /// @dev Deploys a deterministic ERC1967I beacon proxy with `args` and `salt`. |
| 2569 | function deployDeterministicERC1967IBeaconProxy(address beacon, bytes memory args, bytes32 salt) |
| 2570 | internal |
| 2571 | returns (address instance) |
| 2572 | { |
| 2573 | instance = deployDeterministicERC1967IBeaconProxy(0, beacon, args, salt); |
| 2574 | } |
| 2575 | |
| 2576 | /// @dev Deploys a deterministic ERC1967I beacon proxy with `args` and `salt`. |
| 2577 | /// Deposits `value` ETH during deployment. |
| 2578 | function deployDeterministicERC1967IBeaconProxy( |
| 2579 | uint256 value, |
| 2580 | address beacon, |
| 2581 | bytes memory args, |
| 2582 | bytes32 salt |
| 2583 | ) internal returns (address instance) { |
| 2584 | /// @solidity memory-safe-assembly |
| 2585 | assembly { |
| 2586 | let m := mload(0x40) // Cache the free memory pointer. |
| 2587 | let n := mload(args) |
| 2588 | pop(staticcall(gas(), 4, add(args, 0x20), n, add(m, 0x90), n)) |
| 2589 | mstore(add(m, 0x70), 0x3d50545afa361460525736515af43d600060013e6052573d6001fd5b3d6001f3) |
| 2590 | mstore(add(m, 0x50), 0x527fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b3513) |
| 2591 | mstore(add(m, 0x30), 0x60195155f3363d3d373d3d363d602036600436635c60da1b60e01b36) |
| 2592 | mstore(add(m, 0x14), beacon) |
| 2593 | // Do a out-of-gas revert if `n` is greater than `0xffff - 0x57 = 0xffa8`. |
| 2594 | mstore(add(m, gt(n, 0xffa8)), add(0xfe6100573d8160233d3973, shl(56, n))) |
| 2595 | instance := create2(value, add(m, 0x16), add(n, 0x7a), salt) |
| 2596 | if iszero(instance) { |
| 2597 | mstore(0x00, 0x30116425) // `DeploymentFailed()`. |
| 2598 | revert(0x1c, 0x04) |
| 2599 | } |
| 2600 | } |
| 2601 | } |
| 2602 | |
| 2603 | /// @dev Creates a deterministic ERC1967I beacon proxy with `args` and `salt`. |
| 2604 | /// Note: This method is intended for use in ERC4337 factories, |
| 2605 | /// which are expected to NOT revert if the proxy is already deployed. |
| 2606 | function createDeterministicERC1967IBeaconProxy(address beacon, bytes memory args, bytes32 salt) |
| 2607 | internal |
| 2608 | returns (bool alreadyDeployed, address instance) |
| 2609 | { |
| 2610 | return createDeterministicERC1967IBeaconProxy(0, beacon, args, salt); |
| 2611 | } |
| 2612 | |
| 2613 | /// @dev Creates a deterministic ERC1967I beacon proxy with `args` and `salt`. |
| 2614 | /// Deposits `value` ETH during deployment. |
| 2615 | /// Note: This method is intended for use in ERC4337 factories, |
| 2616 | /// which are expected to NOT revert if the proxy is already deployed. |
| 2617 | function createDeterministicERC1967IBeaconProxy( |
| 2618 | uint256 value, |
| 2619 | address beacon, |
| 2620 | bytes memory args, |
| 2621 | bytes32 salt |
| 2622 | ) internal returns (bool alreadyDeployed, address instance) { |
| 2623 | /// @solidity memory-safe-assembly |
| 2624 | assembly { |
| 2625 | let m := mload(0x40) |
| 2626 | let n := mload(args) |
| 2627 | pop(staticcall(gas(), 4, add(args, 0x20), n, add(m, 0x90), n)) |
| 2628 | mstore(add(m, 0x70), 0x3d50545afa361460525736515af43d600060013e6052573d6001fd5b3d6001f3) |
| 2629 | mstore(add(m, 0x50), 0x527fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b3513) |
| 2630 | mstore(add(m, 0x30), 0x60195155f3363d3d373d3d363d602036600436635c60da1b60e01b36) |
| 2631 | mstore(add(m, 0x14), beacon) |
| 2632 | // Do a out-of-gas revert if `n` is greater than `0xffff - 0x57 = 0xffa8`. |
| 2633 | mstore(add(m, gt(n, 0xffa8)), add(0xfe6100573d8160233d3973, shl(56, n))) |
| 2634 | // Compute and store the bytecode hash. |
| 2635 | mstore8(0x00, 0xff) // Write the prefix. |
| 2636 | mstore(0x35, keccak256(add(m, 0x16), add(n, 0x7a))) |
| 2637 | mstore(0x01, shl(96, address())) |
| 2638 | mstore(0x15, salt) |
| 2639 | instance := keccak256(0x00, 0x55) |
| 2640 | for {} 1 {} { |
| 2641 | if iszero(extcodesize(instance)) { |
| 2642 | instance := create2(value, add(m, 0x16), add(n, 0x7a), salt) |
| 2643 | if iszero(instance) { |
| 2644 | mstore(0x00, 0x30116425) // `DeploymentFailed()`. |
| 2645 | revert(0x1c, 0x04) |
| 2646 | } |
| 2647 | break |
| 2648 | } |
| 2649 | alreadyDeployed := 1 |
| 2650 | if iszero(value) { break } |
| 2651 | if iszero(call(gas(), instance, value, codesize(), 0x00, codesize(), 0x00)) { |
| 2652 | mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`. |
| 2653 | revert(0x1c, 0x04) |
| 2654 | } |
| 2655 | break |
| 2656 | } |
| 2657 | mstore(0x35, 0) // Restore the overwritten part of the free memory pointer. |
| 2658 | } |
| 2659 | } |
| 2660 | |
| 2661 | /// @dev Returns the initialization code of the ERC1967I beacon proxy with `args`. |
| 2662 | function initCodeERC1967IBeaconProxy(address beacon, bytes memory args) |
| 2663 | internal |
| 2664 | pure |
| 2665 | returns (bytes memory c) |
| 2666 | { |
| 2667 | /// @solidity memory-safe-assembly |
| 2668 | assembly { |
| 2669 | c := mload(0x40) |
| 2670 | let n := mload(args) |
| 2671 | // Do a out-of-gas revert if `n` is greater than `0xffff - 0x57 = 0xffa8`. |
| 2672 | returndatacopy(returndatasize(), returndatasize(), gt(n, 0xffa8)) |
| 2673 | for { let i := 0 } lt(i, n) { i := add(i, 0x20) } { |
| 2674 | mstore(add(add(c, 0x9a), i), mload(add(add(args, 0x20), i))) |
| 2675 | } |
| 2676 | mstore(add(c, 0x7a), 0x3d50545afa361460525736515af43d600060013e6052573d6001fd5b3d6001f3) |
| 2677 | mstore(add(c, 0x5a), 0x527fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b3513) |
| 2678 | mstore(add(c, 0x3a), 0x60195155f3363d3d373d3d363d602036600436635c60da1b60e01b36) |
| 2679 | mstore(add(c, 0x1e), beacon) |
| 2680 | mstore(add(c, 0x0a), add(0x6100573d8160233d3973, shl(56, n))) |
| 2681 | mstore(add(c, add(n, 0x9a)), 0) |
| 2682 | mstore(c, add(n, 0x7a)) // Store the length. |
| 2683 | mstore(0x40, add(c, add(n, 0xba))) // Allocate memory. |
| 2684 | } |
| 2685 | } |
| 2686 | |
| 2687 | /// @dev Returns the initialization code hash of the ERC1967I beacon proxy with `args`. |
| 2688 | function initCodeHashERC1967IBeaconProxy(address beacon, bytes memory args) |
| 2689 | internal |
| 2690 | pure |
| 2691 | returns (bytes32 hash) |
| 2692 | { |
| 2693 | /// @solidity memory-safe-assembly |
| 2694 | assembly { |
| 2695 | let c := mload(0x40) // Cache the free memory pointer. |
| 2696 | let n := mload(args) |
| 2697 | // Do a out-of-gas revert if `n` is greater than `0xffff - 0x57 = 0xffa8`. |
| 2698 | returndatacopy(returndatasize(), returndatasize(), gt(n, 0xffa8)) |
| 2699 | for { let i := 0 } lt(i, n) { i := add(i, 0x20) } { |
| 2700 | mstore(add(add(c, 0x90), i), mload(add(add(args, 0x20), i))) |
| 2701 | } |
| 2702 | mstore(add(c, 0x70), 0x3d50545afa361460525736515af43d600060013e6052573d6001fd5b3d6001f3) |
| 2703 | mstore(add(c, 0x50), 0x527fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b3513) |
| 2704 | mstore(add(c, 0x30), 0x60195155f3363d3d373d3d363d602036600436635c60da1b60e01b36) |
| 2705 | mstore(add(c, 0x14), beacon) |
| 2706 | mstore(c, add(0x6100573d8160233d3973, shl(56, n))) |
| 2707 | hash := keccak256(add(c, 0x16), add(n, 0x7a)) |
| 2708 | } |
| 2709 | } |
| 2710 | |
| 2711 | /// @dev Returns the address of the ERC1967I beacon proxy, with `args` and salt` by `deployer`. |
| 2712 | /// Note: The returned result has dirty upper 96 bits. Please clean if used in assembly. |
| 2713 | function predictDeterministicAddressERC1967IBeaconProxy( |
| 2714 | address beacon, |
| 2715 | bytes memory args, |
| 2716 | bytes32 salt, |
| 2717 | address deployer |
| 2718 | ) internal pure returns (address predicted) { |
| 2719 | bytes32 hash = initCodeHashERC1967IBeaconProxy(beacon, args); |
| 2720 | predicted = predictDeterministicAddress(hash, salt, deployer); |
| 2721 | } |
| 2722 | |
| 2723 | /// @dev Equivalent to `argsOnERC1967IBeaconProxy(instance, start, 2 ** 256 - 1)`. |
| 2724 | function argsOnERC1967IBeaconProxy(address instance) |
| 2725 | internal |
| 2726 | view |
| 2727 | returns (bytes memory args) |
| 2728 | { |
| 2729 | /// @solidity memory-safe-assembly |
| 2730 | assembly { |
| 2731 | args := mload(0x40) |
| 2732 | mstore(args, and(0xffffffffff, sub(extcodesize(instance), 0x57))) // Store the length. |
| 2733 | extcodecopy(instance, add(args, 0x20), 0x57, add(mload(args), 0x20)) |
| 2734 | mstore(0x40, add(mload(args), add(args, 0x40))) // Allocate memory. |
| 2735 | } |
| 2736 | } |
| 2737 | |
| 2738 | /// @dev Equivalent to `argsOnERC1967IBeaconProxy(instance, start, 2 ** 256 - 1)`. |
| 2739 | function argsOnERC1967IBeaconProxy(address instance, uint256 start) |
| 2740 | internal |
| 2741 | view |
| 2742 | returns (bytes memory args) |
| 2743 | { |
| 2744 | /// @solidity memory-safe-assembly |
| 2745 | assembly { |
| 2746 | args := mload(0x40) |
| 2747 | let n := and(0xffffffffff, sub(extcodesize(instance), 0x57)) |
| 2748 | let l := sub(n, and(0xffffff, mul(lt(start, n), start))) |
| 2749 | extcodecopy(instance, args, add(start, 0x37), add(l, 0x40)) |
| 2750 | mstore(args, mul(sub(n, start), lt(start, n))) // Store the length. |
| 2751 | mstore(0x40, add(args, add(0x40, mload(args)))) // Allocate memory. |
| 2752 | } |
| 2753 | } |
| 2754 | |
| 2755 | /// @dev Returns a slice of the immutable arguments on `instance` from `start` to `end`. |
| 2756 | /// `start` and `end` will be clamped to the range `[0, args.length]`. |
| 2757 | /// The `instance` MUST be deployed via the ERC1967I beacon proxy with immutable args functions. |
| 2758 | /// Otherwise, the behavior is undefined. |
| 2759 | /// Out-of-gas reverts if `instance` does not have any code. |
| 2760 | function argsOnERC1967IBeaconProxy(address instance, uint256 start, uint256 end) |
| 2761 | internal |
| 2762 | view |
| 2763 | returns (bytes memory args) |
| 2764 | { |
| 2765 | /// @solidity memory-safe-assembly |
| 2766 | assembly { |
| 2767 | args := mload(0x40) |
| 2768 | if iszero(lt(end, 0xffff)) { end := 0xffff } |
| 2769 | let d := mul(sub(end, start), lt(start, end)) |
| 2770 | extcodecopy(instance, args, add(start, 0x37), add(d, 0x20)) |
| 2771 | if iszero(and(0xff, mload(add(args, d)))) { |
| 2772 | let n := sub(extcodesize(instance), 0x57) |
| 2773 | returndatacopy(returndatasize(), returndatasize(), shr(40, n)) |
| 2774 | d := mul(gt(n, start), sub(d, mul(gt(end, n), sub(end, n)))) |
| 2775 | } |
| 2776 | mstore(args, d) // Store the length. |
| 2777 | mstore(add(add(args, 0x20), d), 0) // Zeroize the slot after the bytes. |
| 2778 | mstore(0x40, add(add(args, 0x40), d)) // Allocate memory. |
| 2779 | } |
| 2780 | } |
| 2781 | |
| 2782 | /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ |
| 2783 | /* OTHER OPERATIONS */ |
| 2784 | /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ |
| 2785 | |
| 2786 | /// @dev Returns `address(0)` if the implementation address cannot be determined. |
| 2787 | function implementationOf(address instance) internal view returns (address result) { |
| 2788 | /// @solidity memory-safe-assembly |
| 2789 | assembly { |
| 2790 | for { extcodecopy(instance, 0x00, 0x00, 0x57) } 1 {} { |
| 2791 | if mload(0x2d) { |
| 2792 | // ERC1967I and ERC1967IBeaconProxy detection. |
| 2793 | if or( |
| 2794 | eq(keccak256(0x00, 0x52), ERC1967I_CODE_HASH), |
| 2795 | eq(keccak256(0x00, 0x57), ERC1967I_BEACON_PROXY_CODE_HASH) |
| 2796 | ) { |
| 2797 | pop(staticcall(gas(), instance, 0x00, 0x01, 0x00, 0x20)) |
| 2798 | result := mload(0x0c) |
| 2799 | break |
| 2800 | } |
| 2801 | } |
| 2802 | // 0age clone detection. |
| 2803 | result := mload(0x0b) |
| 2804 | codecopy(0x0b, codesize(), 0x14) // Zeroize the 20 bytes for the address. |
| 2805 | if iszero(xor(keccak256(0x00, 0x2c), CLONE_CODE_HASH)) { break } |
| 2806 | mstore(0x0b, result) // Restore the zeroized memory. |
| 2807 | // CWIA detection. |
| 2808 | result := mload(0x0a) |
| 2809 | codecopy(0x0a, codesize(), 0x14) // Zeroize the 20 bytes for the address. |
| 2810 | if iszero(xor(keccak256(0x00, 0x2d), CWIA_CODE_HASH)) { break } |
| 2811 | mstore(0x0a, result) // Restore the zeroized memory. |
| 2812 | // PUSH0 clone detection. |
| 2813 | result := mload(0x09) |
| 2814 | codecopy(0x09, codesize(), 0x14) // Zeroize the 20 bytes for the address. |
| 2815 | result := shr(xor(keccak256(0x00, 0x2d), PUSH0_CLONE_CODE_HASH), result) |
| 2816 | break |
| 2817 | } |
| 2818 | result := shr(96, result) |
| 2819 | mstore(0x37, 0) // Restore the overwritten part of the free memory pointer. |
| 2820 | } |
| 2821 | } |
| 2822 | |
| 2823 | /// @dev Returns the address when a contract with initialization code hash, |
| 2824 | /// `hash`, is deployed with `salt`, by `deployer`. |
| 2825 | /// Note: The returned result has dirty upper 96 bits. Please clean if used in assembly. |
| 2826 | function predictDeterministicAddress(bytes32 hash, bytes32 salt, address deployer) |
| 2827 | internal |
| 2828 | pure |
| 2829 | returns (address predicted) |
| 2830 | { |
| 2831 | /// @solidity memory-safe-assembly |
| 2832 | assembly { |
| 2833 | // Compute and store the bytecode hash. |
| 2834 | mstore8(0x00, 0xff) // Write the prefix. |
| 2835 | mstore(0x35, hash) |
| 2836 | mstore(0x01, shl(96, deployer)) |
| 2837 | mstore(0x15, salt) |
| 2838 | predicted := keccak256(0x00, 0x55) |
| 2839 | mstore(0x35, 0) // Restore the overwritten part of the free memory pointer. |
| 2840 | } |
| 2841 | } |
| 2842 | |
| 2843 | /// @dev Requires that `salt` starts with either the zero address or `by`. |
| 2844 | function checkStartsWith(bytes32 salt, address by) internal pure { |
| 2845 | /// @solidity memory-safe-assembly |
| 2846 | assembly { |
| 2847 | // If the salt does not start with the zero address or `by`. |
| 2848 | if iszero(or(iszero(shr(96, salt)), eq(shr(96, shl(96, by)), shr(96, salt)))) { |
| 2849 | mstore(0x00, 0x0c4549ef) // `SaltDoesNotStartWith()`. |
| 2850 | revert(0x1c, 0x04) |
| 2851 | } |
| 2852 | } |
| 2853 | } |
| 2854 | |
| 2855 | /// @dev Returns the `bytes32` at `offset` in `args`, without any bounds checks. |
| 2856 | /// To load an address, you can use `address(bytes20(argLoad(args, offset)))`. |
| 2857 | function argLoad(bytes memory args, uint256 offset) internal pure returns (bytes32 result) { |
| 2858 | /// @solidity memory-safe-assembly |
| 2859 | assembly { |
| 2860 | result := mload(add(add(args, 0x20), offset)) |
| 2861 | } |
| 2862 | } |
| 2863 | } |
| 2864 |
81.0%
lib/solady/src/utils/ReentrancyGuardTransient.sol
Lines covered: 9 / 11 (81.0%)
| 1 | // SPDX-License-Identifier: MIT |
| 2 | pragma solidity ^0.8.24; |
| 3 | |
| 4 | /// @notice Reentrancy guard mixin (transient storage variant). |
| 5 | /// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/ReentrancyGuardTransient.sol) |
| 6 | /// |
| 7 | /// @dev Note: This implementation utilizes the `TSTORE` and `TLOAD` opcodes. |
| 8 | /// Please ensure that the chain you are deploying on supports them. |
| 9 | abstract contract ReentrancyGuardTransient { |
| 10 | /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ |
| 11 | /* CUSTOM ERRORS */ |
| 12 | /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ |
| 13 | |
| 14 | /// @dev Unauthorized reentrant call. |
| 15 | error Reentrancy(); |
| 16 | |
| 17 | /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ |
| 18 | /* STORAGE */ |
| 19 | /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ |
| 20 | |
| 21 | /// @dev Equivalent to: `uint32(bytes4(keccak256("Reentrancy()"))) | 1 << 71`. |
| 22 | /// 9 bytes is large enough to avoid collisions in practice, |
| 23 | /// but not too large to result in excessive bytecode bloat. |
| 24 | uint256 private constant _REENTRANCY_GUARD_SLOT = 0x8000000000ab143c06; |
| 25 | |
| 26 | /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ |
| 27 | /* REENTRANCY GUARD */ |
| 28 | /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ |
| 29 | |
| 30 | /// @dev Guards a function from reentrancy. |
| 31 | modifier nonReentrant() virtual { |
| 32 | if (_useTransientReentrancyGuardOnlyOnMainnet()) { |
| 33 | uint256 s = _REENTRANCY_GUARD_SLOT; |
| 34 | if (block.chainid == 1) { |
| 35 | /// @solidity memory-safe-assembly |
| 36 | assembly { |
| 37 | if tload(s) { |
| 38 | mstore(0x00, s) // `Reentrancy()`. |
| 39 | revert(0x1c, 0x04) |
| 40 | } |
| 41 | tstore(s, address()) |
| 42 | } |
| 43 | } else { |
| 44 | /// @solidity memory-safe-assembly |
| 45 | assembly { |
| 46 | if eq(sload(s), address()) { |
| 47 | mstore(0x00, s) // `Reentrancy()`. |
| 48 | revert(0x1c, 0x04) |
| 49 | } |
| 50 | sstore(s, address()) |
| 51 | } |
| 52 | } |
| 53 | } else { |
| 54 | /// @solidity memory-safe-assembly |
| 55 | assembly { |
| 56 | if tload(_REENTRANCY_GUARD_SLOT) { |
| 57 | mstore(0x00, 0xab143c06) // `Reentrancy()`. |
| 58 | revert(0x1c, 0x04) |
| 59 | } |
| 60 | tstore(_REENTRANCY_GUARD_SLOT, address()) |
| 61 | } |
| 62 | } |
| 63 | _; |
| 64 | if (_useTransientReentrancyGuardOnlyOnMainnet()) { |
| 65 | uint256 s = _REENTRANCY_GUARD_SLOT; |
| 66 | if (block.chainid == 1) { |
| 67 | /// @solidity memory-safe-assembly |
| 68 | assembly { |
| 69 | tstore(s, 0) |
| 70 | } |
| 71 | } else { |
| 72 | /// @solidity memory-safe-assembly |
| 73 | assembly { |
| 74 | sstore(s, s) |
| 75 | } |
| 76 | } |
| 77 | } else { |
| 78 | /// @solidity memory-safe-assembly |
| 79 | assembly { |
| 80 | tstore(_REENTRANCY_GUARD_SLOT, 0) |
| 81 | } |
| 82 | } |
| 83 | } |
| 84 | |
| 85 | /// @dev Guards a view function from read-only reentrancy. |
| 86 | modifier nonReadReentrant() virtual { |
| 87 | if (_useTransientReentrancyGuardOnlyOnMainnet()) { |
| 88 | uint256 s = _REENTRANCY_GUARD_SLOT; |
| 89 | if (block.chainid == 1) { |
| 90 | /// @solidity memory-safe-assembly |
| 91 | assembly { |
| 92 | if tload(s) { |
| 93 | mstore(0x00, s) // `Reentrancy()`. |
| 94 | revert(0x1c, 0x04) |
| 95 | } |
| 96 | } |
| 97 | } else { |
| 98 | /// @solidity memory-safe-assembly |
| 99 | assembly { |
| 100 | if eq(sload(s), address()) { |
| 101 | mstore(0x00, s) // `Reentrancy()`. |
| 102 | revert(0x1c, 0x04) |
| 103 | } |
| 104 | } |
| 105 | } |
| 106 | } else { |
| 107 | /// @solidity memory-safe-assembly |
| 108 | assembly { |
| 109 | if tload(_REENTRANCY_GUARD_SLOT) { |
| 110 | mstore(0x00, 0xab143c06) // `Reentrancy()`. |
| 111 | revert(0x1c, 0x04) |
| 112 | } |
| 113 | } |
| 114 | } |
| 115 | _; |
| 116 | } |
| 117 | |
| 118 | /// @dev For widespread compatibility with L2s. |
| 119 | /// Only Ethereum mainnet is expensive anyways. |
| 120 | function _useTransientReentrancyGuardOnlyOnMainnet() internal view virtual returns (bool) { |
| 121 | return true; |
| 122 | } |
| 123 | } |
| 124 |
25.0%
lib/solady/src/utils/SafeTransferLib.sol
Lines covered: 1 / 4 (25.0%)
| 1 | // SPDX-License-Identifier: MIT |
| 2 | pragma solidity ^0.8.4; |
| 3 | |
| 4 | /// @notice Safe ETH and ERC20 transfer library that gracefully handles missing return values. |
| 5 | /// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/SafeTransferLib.sol) |
| 6 | /// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/SafeTransferLib.sol) |
| 7 | /// @author Permit2 operations from (https://github.com/Uniswap/permit2/blob/main/src/libraries/Permit2Lib.sol) |
| 8 | /// |
| 9 | /// @dev Note: |
| 10 | /// - For ETH transfers, please use `forceSafeTransferETH` for DoS protection. |
| 11 | library SafeTransferLib { |
| 12 | /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ |
| 13 | /* CUSTOM ERRORS */ |
| 14 | /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ |
| 15 | |
| 16 | /// @dev The ETH transfer has failed. |
| 17 | error ETHTransferFailed(); |
| 18 | |
| 19 | /// @dev The ERC20 `transferFrom` has failed. |
| 20 | error TransferFromFailed(); |
| 21 | |
| 22 | /// @dev The ERC20 `transfer` has failed. |
| 23 | error TransferFailed(); |
| 24 | |
| 25 | /// @dev The ERC20 `approve` has failed. |
| 26 | error ApproveFailed(); |
| 27 | |
| 28 | /// @dev The ERC20 `totalSupply` query has failed. |
| 29 | error TotalSupplyQueryFailed(); |
| 30 | |
| 31 | /// @dev The Permit2 operation has failed. |
| 32 | error Permit2Failed(); |
| 33 | |
| 34 | /// @dev The Permit2 amount must be less than `2**160 - 1`. |
| 35 | error Permit2AmountOverflow(); |
| 36 | |
| 37 | /// @dev The Permit2 approve operation has failed. |
| 38 | error Permit2ApproveFailed(); |
| 39 | |
| 40 | /// @dev The Permit2 lockdown operation has failed. |
| 41 | error Permit2LockdownFailed(); |
| 42 | |
| 43 | /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ |
| 44 | /* CONSTANTS */ |
| 45 | /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ |
| 46 | |
| 47 | /// @dev Suggested gas stipend for contract receiving ETH that disallows any storage writes. |
| 48 | uint256 internal constant GAS_STIPEND_NO_STORAGE_WRITES = 2300; |
| 49 | |
| 50 | /// @dev Suggested gas stipend for contract receiving ETH to perform a few |
| 51 | /// storage reads and writes, but low enough to prevent griefing. |
| 52 | uint256 internal constant GAS_STIPEND_NO_GRIEF = 100000; |
| 53 | |
| 54 | /// @dev The unique EIP-712 domain separator for the DAI token contract. |
| 55 | bytes32 internal constant DAI_DOMAIN_SEPARATOR = |
| 56 | 0xdbb8cf42e1ecb028be3f3dbc922e1d878b963f411dc388ced501601c60f7c6f7; |
| 57 | |
| 58 | /// @dev The address for the WETH9 contract on Ethereum mainnet. |
| 59 | address internal constant WETH9 = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; |
| 60 | |
| 61 | /// @dev The canonical Permit2 address. |
| 62 | /// [Github](https://github.com/Uniswap/permit2) |
| 63 | /// [Etherscan](https://etherscan.io/address/0x000000000022D473030F116dDEE9F6B43aC78BA3) |
| 64 | address internal constant PERMIT2 = 0x000000000022D473030F116dDEE9F6B43aC78BA3; |
| 65 | |
| 66 | /// @dev The canonical address of the `SELFDESTRUCT` ETH mover. |
| 67 | /// See: https://gist.github.com/Vectorized/1cb8ad4cf393b1378e08f23f79bd99fa |
| 68 | /// [Etherscan](https://etherscan.io/address/0x00000000000073c48c8055bD43D1A53799176f0D) |
| 69 | address internal constant ETH_MOVER = 0x00000000000073c48c8055bD43D1A53799176f0D; |
| 70 | |
| 71 | /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ |
| 72 | /* ETH OPERATIONS */ |
| 73 | /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ |
| 74 | |
| 75 | // If the ETH transfer MUST succeed with a reasonable gas budget, use the force variants. |
| 76 | // |
| 77 | // The regular variants: |
| 78 | // - Forwards all remaining gas to the target. |
| 79 | // - Reverts if the target reverts. |
| 80 | // - Reverts if the current contract has insufficient balance. |
| 81 | // |
| 82 | // The force variants: |
| 83 | // - Forwards with an optional gas stipend |
| 84 | // (defaults to `GAS_STIPEND_NO_GRIEF`, which is sufficient for most cases). |
| 85 | // - If the target reverts, or if the gas stipend is exhausted, |
| 86 | // creates a temporary contract to force send the ETH via `SELFDESTRUCT`. |
| 87 | // Future compatible with `SENDALL`: https://eips.ethereum.org/EIPS/eip-4758. |
| 88 | // - Reverts if the current contract has insufficient balance. |
| 89 | // |
| 90 | // The try variants: |
| 91 | // - Forwards with a mandatory gas stipend. |
| 92 | // - Instead of reverting, returns whether the transfer succeeded. |
| 93 | |
| 94 | /// @dev Sends `amount` (in wei) ETH to `to`. |
| 95 | function safeTransferETH(address to, uint256 amount) internal { |
| 96 | /// @solidity memory-safe-assembly |
| 97 | assembly { |
| 98 | if iszero(call(gas(), to, amount, codesize(), 0x00, codesize(), 0x00)) { |
| 99 | mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`. |
| 100 | revert(0x1c, 0x04) |
| 101 | } |
| 102 | } |
| 103 | } |
| 104 | |
| 105 | /// @dev Sends all the ETH in the current contract to `to`. |
| 106 | function safeTransferAllETH(address to) internal { |
| 107 | /// @solidity memory-safe-assembly |
| 108 | assembly { |
| 109 | // Transfer all the ETH and check if it succeeded or not. |
| 110 | if iszero(call(gas(), to, selfbalance(), codesize(), 0x00, codesize(), 0x00)) { |
| 111 | mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`. |
| 112 | revert(0x1c, 0x04) |
| 113 | } |
| 114 | } |
| 115 | } |
| 116 | |
| 117 | /// @dev Force sends `amount` (in wei) ETH to `to`, with a `gasStipend`. |
| 118 | function forceSafeTransferETH(address to, uint256 amount, uint256 gasStipend) internal { |
| 119 | /// @solidity memory-safe-assembly |
| 120 | assembly { |
| 121 | if lt(selfbalance(), amount) { |
| 122 | mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`. |
| 123 | revert(0x1c, 0x04) |
| 124 | } |
| 125 | if iszero(call(gasStipend, to, amount, codesize(), 0x00, codesize(), 0x00)) { |
| 126 | mstore(0x00, to) // Store the address in scratch space. |
| 127 | mstore8(0x0b, 0x73) // Opcode `PUSH20`. |
| 128 | mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`. |
| 129 | if iszero(create(amount, 0x0b, 0x16)) { revert(codesize(), codesize()) } // For gas estimation. |
| 130 | } |
| 131 | } |
| 132 | } |
| 133 | |
| 134 | /// @dev Force sends all the ETH in the current contract to `to`, with a `gasStipend`. |
| 135 | function forceSafeTransferAllETH(address to, uint256 gasStipend) internal { |
| 136 | /// @solidity memory-safe-assembly |
| 137 | assembly { |
| 138 | if iszero(call(gasStipend, to, selfbalance(), codesize(), 0x00, codesize(), 0x00)) { |
| 139 | mstore(0x00, to) // Store the address in scratch space. |
| 140 | mstore8(0x0b, 0x73) // Opcode `PUSH20`. |
| 141 | mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`. |
| 142 | if iszero(create(selfbalance(), 0x0b, 0x16)) { revert(codesize(), codesize()) } // For gas estimation. |
| 143 | } |
| 144 | } |
| 145 | } |
| 146 | |
| 147 | /// @dev Force sends `amount` (in wei) ETH to `to`, with `GAS_STIPEND_NO_GRIEF`. |
| 148 | function forceSafeTransferETH(address to, uint256 amount) internal { |
| 149 | /// @solidity memory-safe-assembly |
| 150 | assembly { |
| 151 | if lt(selfbalance(), amount) { |
| 152 | mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`. |
| 153 | revert(0x1c, 0x04) |
| 154 | } |
| 155 | if iszero(call(GAS_STIPEND_NO_GRIEF, to, amount, codesize(), 0x00, codesize(), 0x00)) { |
| 156 | mstore(0x00, to) // Store the address in scratch space. |
| 157 | mstore8(0x0b, 0x73) // Opcode `PUSH20`. |
| 158 | mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`. |
| 159 | if iszero(create(amount, 0x0b, 0x16)) { revert(codesize(), codesize()) } // For gas estimation. |
| 160 | } |
| 161 | } |
| 162 | } |
| 163 | |
| 164 | /// @dev Force sends all the ETH in the current contract to `to`, with `GAS_STIPEND_NO_GRIEF`. |
| 165 | function forceSafeTransferAllETH(address to) internal { |
| 166 | /// @solidity memory-safe-assembly |
| 167 | assembly { |
| 168 | // forgefmt: disable-next-item |
| 169 | if iszero(call(GAS_STIPEND_NO_GRIEF, to, selfbalance(), codesize(), 0x00, codesize(), 0x00)) { |
| 170 | mstore(0x00, to) // Store the address in scratch space. |
| 171 | mstore8(0x0b, 0x73) // Opcode `PUSH20`. |
| 172 | mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`. |
| 173 | if iszero(create(selfbalance(), 0x0b, 0x16)) { revert(codesize(), codesize()) } // For gas estimation. |
| 174 | } |
| 175 | } |
| 176 | } |
| 177 | |
| 178 | /// @dev Sends `amount` (in wei) ETH to `to`, with a `gasStipend`. |
| 179 | function trySafeTransferETH(address to, uint256 amount, uint256 gasStipend) |
| 180 | internal |
| 181 | returns (bool success) |
| 182 | { |
| 183 | /// @solidity memory-safe-assembly |
| 184 | assembly { |
| 185 | success := call(gasStipend, to, amount, codesize(), 0x00, codesize(), 0x00) |
| 186 | } |
| 187 | } |
| 188 | |
| 189 | /// @dev Sends all the ETH in the current contract to `to`, with a `gasStipend`. |
| 190 | function trySafeTransferAllETH(address to, uint256 gasStipend) |
| 191 | internal |
| 192 | returns (bool success) |
| 193 | { |
| 194 | /// @solidity memory-safe-assembly |
| 195 | assembly { |
| 196 | success := call(gasStipend, to, selfbalance(), codesize(), 0x00, codesize(), 0x00) |
| 197 | } |
| 198 | } |
| 199 | |
| 200 | /// @dev Force transfers ETH to `to`, without triggering the fallback (if any). |
| 201 | /// This method attempts to use a separate contract to send via `SELFDESTRUCT`, |
| 202 | /// and upon failure, deploys a minimal vault to accrue the ETH. |
| 203 | function safeMoveETH(address to, uint256 amount) internal returns (address vault) { |
| 204 | /// @solidity memory-safe-assembly |
| 205 | assembly { |
| 206 | to := shr(96, shl(96, to)) // Clean upper 96 bits. |
| 207 | for { let mover := ETH_MOVER } iszero(eq(to, address())) {} { |
| 208 | let selfBalanceBefore := selfbalance() |
| 209 | if or(lt(selfBalanceBefore, amount), eq(to, mover)) { |
| 210 | mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`. |
| 211 | revert(0x1c, 0x04) |
| 212 | } |
| 213 | if extcodesize(mover) { |
| 214 | let balanceBefore := balance(to) // Check via delta, in case `SELFDESTRUCT` is bricked. |
| 215 | mstore(0x00, to) |
| 216 | pop(call(gas(), mover, amount, 0x00, 0x20, codesize(), 0x00)) |
| 217 | // If `address(to).balance >= amount + balanceBefore`, skip vault workflow. |
| 218 | if iszero(lt(balance(to), add(amount, balanceBefore))) { break } |
| 219 | // Just in case `SELFDESTRUCT` is changed to not revert and do nothing. |
| 220 | if lt(selfBalanceBefore, selfbalance()) { invalid() } |
| 221 | } |
| 222 | let m := mload(0x40) |
| 223 | // If the mover is missing or bricked, deploy a minimal vault |
| 224 | // that withdraws all ETH to `to` when being called only by `to`. |
| 225 | // forgefmt: disable-next-item |
| 226 | mstore(add(m, 0x20), 0x33146025575b600160005260206000f35b3d3d3d3d47335af1601a5760003dfd) |
| 227 | mstore(m, or(to, shl(160, 0x6035600b3d3960353df3fe73))) |
| 228 | // Compute and store the bytecode hash. |
| 229 | mstore8(0x00, 0xff) // Write the prefix. |
| 230 | mstore(0x35, keccak256(m, 0x40)) |
| 231 | mstore(0x01, shl(96, address())) // Deployer. |
| 232 | mstore(0x15, 0) // Salt. |
| 233 | vault := keccak256(0x00, 0x55) |
| 234 | pop(call(gas(), vault, amount, codesize(), 0x00, codesize(), 0x00)) |
| 235 | // The vault returns a single word on success. Failure reverts with empty data. |
| 236 | if iszero(returndatasize()) { |
| 237 | if iszero(create2(0, m, 0x40, 0)) { revert(codesize(), codesize()) } // For gas estimation. |
| 238 | } |
| 239 | mstore(0x40, m) // Restore the free memory pointer. |
| 240 | break |
| 241 | } |
| 242 | } |
| 243 | } |
| 244 | |
| 245 | /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ |
| 246 | /* ERC20 OPERATIONS */ |
| 247 | /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ |
| 248 | |
| 249 | /// @dev Sends `amount` of ERC20 `token` from `from` to `to`. |
| 250 | /// Reverts upon failure. |
| 251 | /// |
| 252 | /// The `from` account must have at least `amount` approved for |
| 253 | /// the current contract to manage. |
| 254 | function safeTransferFrom(address token, address from, address to, uint256 amount) internal { |
| 255 | /// @solidity memory-safe-assembly |
| 256 | assembly { |
| 257 | let m := mload(0x40) // Cache the free memory pointer. |
| 258 | mstore(0x60, amount) // Store the `amount` argument. |
| 259 | mstore(0x40, to) // Store the `to` argument. |
| 260 | mstore(0x2c, shl(96, from)) // Store the `from` argument. |
| 261 | mstore(0x0c, 0x23b872dd000000000000000000000000) // `transferFrom(address,address,uint256)`. |
| 262 | let success := call(gas(), token, 0, 0x1c, 0x64, 0x00, 0x20) |
| 263 | if iszero(and(eq(mload(0x00), 1), success)) { |
| 264 | if iszero(lt(or(iszero(extcodesize(token)), returndatasize()), success)) { |
| 265 | mstore(0x00, 0x7939f424) // `TransferFromFailed()`. |
| 266 | revert(0x1c, 0x04) |
| 267 | } |
| 268 | } |
| 269 | mstore(0x60, 0) // Restore the zero slot to zero. |
| 270 | mstore(0x40, m) // Restore the free memory pointer. |
| 271 | } |
| 272 | } |
| 273 | |
| 274 | /// @dev Sends `amount` of ERC20 `token` from `from` to `to`. |
| 275 | /// |
| 276 | /// The `from` account must have at least `amount` approved for the current contract to manage. |
| 277 | function trySafeTransferFrom(address token, address from, address to, uint256 amount) |
| 278 | internal |
| 279 | returns (bool success) |
| 280 | { |
| 281 | /// @solidity memory-safe-assembly |
| 282 | assembly { |
| 283 | let m := mload(0x40) // Cache the free memory pointer. |
| 284 | mstore(0x60, amount) // Store the `amount` argument. |
| 285 | mstore(0x40, to) // Store the `to` argument. |
| 286 | mstore(0x2c, shl(96, from)) // Store the `from` argument. |
| 287 | mstore(0x0c, 0x23b872dd000000000000000000000000) // `transferFrom(address,address,uint256)`. |
| 288 | success := call(gas(), token, 0, 0x1c, 0x64, 0x00, 0x20) |
| 289 | if iszero(and(eq(mload(0x00), 1), success)) { |
| 290 | success := lt(or(iszero(extcodesize(token)), returndatasize()), success) |
| 291 | } |
| 292 | mstore(0x60, 0) // Restore the zero slot to zero. |
| 293 | mstore(0x40, m) // Restore the free memory pointer. |
| 294 | } |
| 295 | } |
| 296 | |
| 297 | /// @dev Sends all of ERC20 `token` from `from` to `to`. |
| 298 | /// Reverts upon failure. |
| 299 | /// |
| 300 | /// The `from` account must have their entire balance approved for the current contract to manage. |
| 301 | function safeTransferAllFrom(address token, address from, address to) |
| 302 | internal |
| 303 | returns (uint256 amount) |
| 304 | { |
| 305 | /// @solidity memory-safe-assembly |
| 306 | assembly { |
| 307 | let m := mload(0x40) // Cache the free memory pointer. |
| 308 | mstore(0x40, to) // Store the `to` argument. |
| 309 | mstore(0x2c, shl(96, from)) // Store the `from` argument. |
| 310 | mstore(0x0c, 0x70a08231000000000000000000000000) // `balanceOf(address)`. |
| 311 | // Read the balance, reverting upon failure. |
| 312 | if iszero( |
| 313 | and( // The arguments of `and` are evaluated from right to left. |
| 314 | gt(returndatasize(), 0x1f), // At least 32 bytes returned. |
| 315 | staticcall(gas(), token, 0x1c, 0x24, 0x60, 0x20) |
| 316 | ) |
| 317 | ) { |
| 318 | mstore(0x00, 0x7939f424) // `TransferFromFailed()`. |
| 319 | revert(0x1c, 0x04) |
| 320 | } |
| 321 | mstore(0x00, 0x23b872dd) // `transferFrom(address,address,uint256)`. |
| 322 | amount := mload(0x60) // The `amount` is already at 0x60. We'll need to return it. |
| 323 | // Perform the transfer, reverting upon failure. |
| 324 | let success := call(gas(), token, 0, 0x1c, 0x64, 0x00, 0x20) |
| 325 | if iszero(and(eq(mload(0x00), 1), success)) { |
| 326 | if iszero(lt(or(iszero(extcodesize(token)), returndatasize()), success)) { |
| 327 | mstore(0x00, 0x7939f424) // `TransferFromFailed()`. |
| 328 | revert(0x1c, 0x04) |
| 329 | } |
| 330 | } |
| 331 | mstore(0x60, 0) // Restore the zero slot to zero. |
| 332 | mstore(0x40, m) // Restore the free memory pointer. |
| 333 | } |
| 334 | } |
| 335 | |
| 336 | /// @dev Sends `amount` of ERC20 `token` from the current contract to `to`. |
| 337 | /// Reverts upon failure. |
| 338 | function safeTransfer(address token, address to, uint256 amount) internal { |
| 339 | /// @solidity memory-safe-assembly |
| 340 | assembly { |
| 341 | mstore(0x14, to) // Store the `to` argument. |
| 342 | mstore(0x34, amount) // Store the `amount` argument. |
| 343 | mstore(0x00, 0xa9059cbb000000000000000000000000) // `transfer(address,uint256)`. |
| 344 | // Perform the transfer, reverting upon failure. |
| 345 | let success := call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20) |
| 346 | if iszero(and(eq(mload(0x00), 1), success)) { |
| 347 | if iszero(lt(or(iszero(extcodesize(token)), returndatasize()), success)) { |
| 348 | mstore(0x00, 0x90b8ec18) // `TransferFailed()`. |
| 349 | revert(0x1c, 0x04) |
| 350 | } |
| 351 | } |
| 352 | mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten. |
| 353 | } |
| 354 | } |
| 355 | |
| 356 | /// @dev Sends all of ERC20 `token` from the current contract to `to`. |
| 357 | /// Reverts upon failure. |
| 358 | function safeTransferAll(address token, address to) internal returns (uint256 amount) { |
| 359 | /// @solidity memory-safe-assembly |
| 360 | assembly { |
| 361 | mstore(0x00, 0x70a08231) // Store the function selector of `balanceOf(address)`. |
| 362 | mstore(0x20, address()) // Store the address of the current contract. |
| 363 | // Read the balance, reverting upon failure. |
| 364 | if iszero( |
| 365 | and( // The arguments of `and` are evaluated from right to left. |
| 366 | gt(returndatasize(), 0x1f), // At least 32 bytes returned. |
| 367 | staticcall(gas(), token, 0x1c, 0x24, 0x34, 0x20) |
| 368 | ) |
| 369 | ) { |
| 370 | mstore(0x00, 0x90b8ec18) // `TransferFailed()`. |
| 371 | revert(0x1c, 0x04) |
| 372 | } |
| 373 | mstore(0x14, to) // Store the `to` argument. |
| 374 | amount := mload(0x34) // The `amount` is already at 0x34. We'll need to return it. |
| 375 | mstore(0x00, 0xa9059cbb000000000000000000000000) // `transfer(address,uint256)`. |
| 376 | // Perform the transfer, reverting upon failure. |
| 377 | let success := call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20) |
| 378 | if iszero(and(eq(mload(0x00), 1), success)) { |
| 379 | if iszero(lt(or(iszero(extcodesize(token)), returndatasize()), success)) { |
| 380 | mstore(0x00, 0x90b8ec18) // `TransferFailed()`. |
| 381 | revert(0x1c, 0x04) |
| 382 | } |
| 383 | } |
| 384 | mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten. |
| 385 | } |
| 386 | } |
| 387 | |
| 388 | /// @dev Sets `amount` of ERC20 `token` for `to` to manage on behalf of the current contract. |
| 389 | /// Reverts upon failure. |
| 390 | function safeApprove(address token, address to, uint256 amount) internal { |
| 391 | /// @solidity memory-safe-assembly |
| 392 | assembly { |
| 393 | mstore(0x14, to) // Store the `to` argument. |
| 394 | mstore(0x34, amount) // Store the `amount` argument. |
| 395 | mstore(0x00, 0x095ea7b3000000000000000000000000) // `approve(address,uint256)`. |
| 396 | let success := call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20) |
| 397 | if iszero(and(eq(mload(0x00), 1), success)) { |
| 398 | if iszero(lt(or(iszero(extcodesize(token)), returndatasize()), success)) { |
| 399 | mstore(0x00, 0x3e3f8f73) // `ApproveFailed()`. |
| 400 | revert(0x1c, 0x04) |
| 401 | } |
| 402 | } |
| 403 | mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten. |
| 404 | } |
| 405 | } |
| 406 | |
| 407 | /// @dev Sets `amount` of ERC20 `token` for `to` to manage on behalf of the current contract. |
| 408 | /// If the initial attempt to approve fails, attempts to reset the approved amount to zero, |
| 409 | /// then retries the approval again (some tokens, e.g. USDT, requires this). |
| 410 | /// Reverts upon failure. |
| 411 | function safeApproveWithRetry(address token, address to, uint256 amount) internal { |
| 412 | /// @solidity memory-safe-assembly |
| 413 | assembly { |
| 414 | mstore(0x14, to) // Store the `to` argument. |
| 415 | mstore(0x34, amount) // Store the `amount` argument. |
| 416 | mstore(0x00, 0x095ea7b3000000000000000000000000) // `approve(address,uint256)`. |
| 417 | // Perform the approval, retrying upon failure. |
| 418 | let success := call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20) |
| 419 | if iszero(and(eq(mload(0x00), 1), success)) { |
| 420 | if iszero(lt(or(iszero(extcodesize(token)), returndatasize()), success)) { |
| 421 | mstore(0x34, 0) // Store 0 for the `amount`. |
| 422 | mstore(0x00, 0x095ea7b3000000000000000000000000) // `approve(address,uint256)`. |
| 423 | pop(call(gas(), token, 0, 0x10, 0x44, codesize(), 0x00)) // Reset the approval. |
| 424 | mstore(0x34, amount) // Store back the original `amount`. |
| 425 | // Retry the approval, reverting upon failure. |
| 426 | success := call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20) |
| 427 | if iszero(and(eq(mload(0x00), 1), success)) { |
| 428 | // Check the `extcodesize` again just in case the token selfdestructs lol. |
| 429 | if iszero(lt(or(iszero(extcodesize(token)), returndatasize()), success)) { |
| 430 | mstore(0x00, 0x3e3f8f73) // `ApproveFailed()`. |
| 431 | revert(0x1c, 0x04) |
| 432 | } |
| 433 | } |
| 434 | } |
| 435 | } |
| 436 | mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten. |
| 437 | } |
| 438 | } |
| 439 | |
| 440 | /// @dev Returns the amount of ERC20 `token` owned by `account`. |
| 441 | /// Returns zero if the `token` does not exist. |
| 442 | function balanceOf(address token, address account) internal view returns (uint256 amount) { |
| 443 | /// @solidity memory-safe-assembly |
| 444 | assembly { |
| 445 | mstore(0x14, account) // Store the `account` argument. |
| 446 | mstore(0x00, 0x70a08231000000000000000000000000) // `balanceOf(address)`. |
| 447 | amount := |
| 448 | mul( // The arguments of `mul` are evaluated from right to left. |
| 449 | mload(0x20), |
| 450 | and( // The arguments of `and` are evaluated from right to left. |
| 451 | gt(returndatasize(), 0x1f), // At least 32 bytes returned. |
| 452 | staticcall(gas(), token, 0x10, 0x24, 0x20, 0x20) |
| 453 | ) |
| 454 | ) |
| 455 | } |
| 456 | } |
| 457 | |
| 458 | /// @dev Performs a `token.balanceOf(account)` check. |
| 459 | /// `implemented` denotes whether the `token` does not implement `balanceOf`. |
| 460 | /// `amount` is zero if the `token` does not implement `balanceOf`. |
| 461 | function checkBalanceOf(address token, address account) |
| 462 | internal |
| 463 | view |
| 464 | returns (bool implemented, uint256 amount) |
| 465 | { |
| 466 | /// @solidity memory-safe-assembly |
| 467 | assembly { |
| 468 | mstore(0x14, account) // Store the `account` argument. |
| 469 | mstore(0x00, 0x70a08231000000000000000000000000) // `balanceOf(address)`. |
| 470 | implemented := |
| 471 | and( // The arguments of `and` are evaluated from right to left. |
| 472 | gt(returndatasize(), 0x1f), // At least 32 bytes returned. |
| 473 | staticcall(gas(), token, 0x10, 0x24, 0x20, 0x20) |
| 474 | ) |
| 475 | amount := mul(mload(0x20), implemented) |
| 476 | } |
| 477 | } |
| 478 | |
| 479 | /// @dev Returns the total supply of the `token`. |
| 480 | /// Reverts if the token does not exist or does not implement `totalSupply()`. |
| 481 | function totalSupply(address token) internal view returns (uint256 result) { |
| 482 | /// @solidity memory-safe-assembly |
| 483 | assembly { |
| 484 | mstore(0x00, 0x18160ddd) // `totalSupply()`. |
| 485 | if iszero( |
| 486 | and(gt(returndatasize(), 0x1f), staticcall(gas(), token, 0x1c, 0x04, 0x00, 0x20)) |
| 487 | ) { |
| 488 | mstore(0x00, 0x54cd9435) // `TotalSupplyQueryFailed()`. |
| 489 | revert(0x1c, 0x04) |
| 490 | } |
| 491 | result := mload(0x00) |
| 492 | } |
| 493 | } |
| 494 | |
| 495 | /// @dev Sends `amount` of ERC20 `token` from `from` to `to`. |
| 496 | /// If the initial attempt fails, try to use Permit2 to transfer the token. |
| 497 | /// Reverts upon failure. |
| 498 | /// |
| 499 | /// The `from` account must have at least `amount` approved for the current contract to manage. |
| 500 | function safeTransferFrom2(address token, address from, address to, uint256 amount) internal { |
| 501 | if (!trySafeTransferFrom(token, from, to, amount)) { |
| 502 | permit2TransferFrom(token, from, to, amount); |
| 503 | } |
| 504 | } |
| 505 | |
| 506 | /// @dev Sends `amount` of ERC20 `token` from `from` to `to` via Permit2. |
| 507 | /// Reverts upon failure. |
| 508 | function permit2TransferFrom(address token, address from, address to, uint256 amount) |
| 509 | internal |
| 510 | { |
| 511 | /// @solidity memory-safe-assembly |
| 512 | assembly { |
| 513 | let m := mload(0x40) |
| 514 | mstore(add(m, 0x74), shr(96, shl(96, token))) |
| 515 | mstore(add(m, 0x54), amount) |
| 516 | mstore(add(m, 0x34), to) |
| 517 | mstore(add(m, 0x20), shl(96, from)) |
| 518 | // `transferFrom(address,address,uint160,address)`. |
| 519 | mstore(m, 0x36c78516000000000000000000000000) |
| 520 | let p := PERMIT2 |
| 521 | let exists := eq(chainid(), 1) |
| 522 | if iszero(exists) { exists := iszero(iszero(extcodesize(p))) } |
| 523 | if iszero( |
| 524 | and( |
| 525 | call(gas(), p, 0, add(m, 0x10), 0x84, codesize(), 0x00), |
| 526 | lt(iszero(extcodesize(token)), exists) // Token has code and Permit2 exists. |
| 527 | ) |
| 528 | ) { |
| 529 | mstore(0x00, 0x7939f4248757f0fd) // `TransferFromFailed()` or `Permit2AmountOverflow()`. |
| 530 | revert(add(0x18, shl(2, iszero(iszero(shr(160, amount))))), 0x04) |
| 531 | } |
| 532 | } |
| 533 | } |
| 534 | |
| 535 | /// @dev Permit a user to spend a given amount of |
| 536 | /// another user's tokens via native EIP-2612 permit if possible, falling |
| 537 | /// back to Permit2 if native permit fails or is not implemented on the token. |
| 538 | function permit2( |
| 539 | address token, |
| 540 | address owner, |
| 541 | address spender, |
| 542 | uint256 amount, |
| 543 | uint256 deadline, |
| 544 | uint8 v, |
| 545 | bytes32 r, |
| 546 | bytes32 s |
| 547 | ) internal { |
| 548 | bool success; |
| 549 | /// @solidity memory-safe-assembly |
| 550 | assembly { |
| 551 | for {} shl(96, xor(token, WETH9)) {} { |
| 552 | mstore(0x00, 0x3644e515) // `DOMAIN_SEPARATOR()`. |
| 553 | if iszero( |
| 554 | and( // The arguments of `and` are evaluated from right to left. |
| 555 | lt(iszero(mload(0x00)), eq(returndatasize(), 0x20)), // Returns 1 non-zero word. |
| 556 | // Gas stipend to limit gas burn for tokens that don't refund gas when |
| 557 | // an non-existing function is called. 5K should be enough for a SLOAD. |
| 558 | staticcall(5000, token, 0x1c, 0x04, 0x00, 0x20) |
| 559 | ) |
| 560 | ) { break } |
| 561 | // After here, we can be sure that token is a contract. |
| 562 | let m := mload(0x40) |
| 563 | mstore(add(m, 0x34), spender) |
| 564 | mstore(add(m, 0x20), shl(96, owner)) |
| 565 | mstore(add(m, 0x74), deadline) |
| 566 | if eq(mload(0x00), DAI_DOMAIN_SEPARATOR) { |
| 567 | mstore(0x14, owner) |
| 568 | mstore(0x00, 0x7ecebe00000000000000000000000000) // `nonces(address)`. |
| 569 | mstore( |
| 570 | add(m, 0x94), |
| 571 | lt(iszero(amount), staticcall(gas(), token, 0x10, 0x24, add(m, 0x54), 0x20)) |
| 572 | ) |
| 573 | mstore(m, 0x8fcbaf0c000000000000000000000000) // `IDAIPermit.permit`. |
| 574 | // `nonces` is already at `add(m, 0x54)`. |
| 575 | // `amount != 0` is already stored at `add(m, 0x94)`. |
| 576 | mstore(add(m, 0xb4), and(0xff, v)) |
| 577 | mstore(add(m, 0xd4), r) |
| 578 | mstore(add(m, 0xf4), s) |
| 579 | success := call(gas(), token, 0, add(m, 0x10), 0x104, codesize(), 0x00) |
| 580 | break |
| 581 | } |
| 582 | mstore(m, 0xd505accf000000000000000000000000) // `IERC20Permit.permit`. |
| 583 | mstore(add(m, 0x54), amount) |
| 584 | mstore(add(m, 0x94), and(0xff, v)) |
| 585 | mstore(add(m, 0xb4), r) |
| 586 | mstore(add(m, 0xd4), s) |
| 587 | success := call(gas(), token, 0, add(m, 0x10), 0xe4, codesize(), 0x00) |
| 588 | break |
| 589 | } |
| 590 | } |
| 591 | if (!success) simplePermit2(token, owner, spender, amount, deadline, v, r, s); |
| 592 | } |
| 593 | |
| 594 | /// @dev Simple permit on the Permit2 contract. |
| 595 | function simplePermit2( |
| 596 | address token, |
| 597 | address owner, |
| 598 | address spender, |
| 599 | uint256 amount, |
| 600 | uint256 deadline, |
| 601 | uint8 v, |
| 602 | bytes32 r, |
| 603 | bytes32 s |
| 604 | ) internal { |
| 605 | /// @solidity memory-safe-assembly |
| 606 | assembly { |
| 607 | let m := mload(0x40) |
| 608 | mstore(m, 0x927da105) // `allowance(address,address,address)`. |
| 609 | { |
| 610 | let addressMask := shr(96, not(0)) |
| 611 | mstore(add(m, 0x20), and(addressMask, owner)) |
| 612 | mstore(add(m, 0x40), and(addressMask, token)) |
| 613 | mstore(add(m, 0x60), and(addressMask, spender)) |
| 614 | mstore(add(m, 0xc0), and(addressMask, spender)) |
| 615 | } |
| 616 | let p := mul(PERMIT2, iszero(shr(160, amount))) |
| 617 | if iszero( |
| 618 | and( // The arguments of `and` are evaluated from right to left. |
| 619 | gt(returndatasize(), 0x5f), // Returns 3 words: `amount`, `expiration`, `nonce`. |
| 620 | staticcall(gas(), p, add(m, 0x1c), 0x64, add(m, 0x60), 0x60) |
| 621 | ) |
| 622 | ) { |
| 623 | mstore(0x00, 0x6b836e6b8757f0fd) // `Permit2Failed()` or `Permit2AmountOverflow()`. |
| 624 | revert(add(0x18, shl(2, iszero(p))), 0x04) |
| 625 | } |
| 626 | mstore(m, 0x2b67b570) // `Permit2.permit` (PermitSingle variant). |
| 627 | // `owner` is already `add(m, 0x20)`. |
| 628 | // `token` is already at `add(m, 0x40)`. |
| 629 | mstore(add(m, 0x60), amount) |
| 630 | mstore(add(m, 0x80), 0xffffffffffff) // `expiration = type(uint48).max`. |
| 631 | // `nonce` is already at `add(m, 0xa0)`. |
| 632 | // `spender` is already at `add(m, 0xc0)`. |
| 633 | mstore(add(m, 0xe0), deadline) |
| 634 | mstore(add(m, 0x100), 0x100) // `signature` offset. |
| 635 | mstore(add(m, 0x120), 0x41) // `signature` length. |
| 636 | mstore(add(m, 0x140), r) |
| 637 | mstore(add(m, 0x160), s) |
| 638 | mstore(add(m, 0x180), shl(248, v)) |
| 639 | if iszero( // Revert if token does not have code, or if the call fails. |
| 640 | mul(extcodesize(token), call(gas(), p, 0, add(m, 0x1c), 0x184, codesize(), 0x00))) { |
| 641 | mstore(0x00, 0x6b836e6b) // `Permit2Failed()`. |
| 642 | revert(0x1c, 0x04) |
| 643 | } |
| 644 | } |
| 645 | } |
| 646 | |
| 647 | /// @dev Approves `spender` to spend `amount` of `token` for `address(this)`. |
| 648 | function permit2Approve(address token, address spender, uint160 amount, uint48 expiration) |
| 649 | internal |
| 650 | { |
| 651 | /// @solidity memory-safe-assembly |
| 652 | assembly { |
| 653 | let addressMask := shr(96, not(0)) |
| 654 | let m := mload(0x40) |
| 655 | mstore(m, 0x87517c45) // `approve(address,address,uint160,uint48)`. |
| 656 | mstore(add(m, 0x20), and(addressMask, token)) |
| 657 | mstore(add(m, 0x40), and(addressMask, spender)) |
| 658 | mstore(add(m, 0x60), and(addressMask, amount)) |
| 659 | mstore(add(m, 0x80), and(0xffffffffffff, expiration)) |
| 660 | if iszero(call(gas(), PERMIT2, 0, add(m, 0x1c), 0xa0, codesize(), 0x00)) { |
| 661 | mstore(0x00, 0x324f14ae) // `Permit2ApproveFailed()`. |
| 662 | revert(0x1c, 0x04) |
| 663 | } |
| 664 | } |
| 665 | } |
| 666 | |
| 667 | /// @dev Revokes an approval for `token` and `spender` for `address(this)`. |
| 668 | function permit2Lockdown(address token, address spender) internal { |
| 669 | /// @solidity memory-safe-assembly |
| 670 | assembly { |
| 671 | let m := mload(0x40) |
| 672 | mstore(m, 0xcc53287f) // `Permit2.lockdown`. |
| 673 | mstore(add(m, 0x20), 0x20) // Offset of the `approvals`. |
| 674 | mstore(add(m, 0x40), 1) // `approvals.length`. |
| 675 | mstore(add(m, 0x60), shr(96, shl(96, token))) |
| 676 | mstore(add(m, 0x80), shr(96, shl(96, spender))) |
| 677 | if iszero(call(gas(), PERMIT2, 0, add(m, 0x1c), 0xa0, codesize(), 0x00)) { |
| 678 | mstore(0x00, 0x96b3de23) // `Permit2LockdownFailed()`. |
| 679 | revert(0x1c, 0x04) |
| 680 | } |
| 681 | } |
| 682 | } |
| 683 | } |
| 684 |
0.0%
src/commerce-payments/conditions/ICondition.sol
Lines covered: 0 / 0 (0.0%)
| 1 | // SPDX-License-Identifier: BUSL-1.1 |
| 2 | // Copyright 2025-2026 Ali Abdoli and Vrajang Parikh |
| 3 | pragma solidity ^0.8.28; |
| 4 | |
| 5 | import {AuthCaptureEscrow} from "commerce-payments/AuthCaptureEscrow.sol"; |
| 6 | |
| 7 | /// @title ICondition |
| 8 | /// @notice Interface for checking if an action is allowed before execution |
| 9 | /// @dev Conditions are pure checks - they do not modify state |
| 10 | /// @dev Conditions can be composed using combinators (Or, And, Not) |
| 11 | interface ICondition { |
| 12 | /// @notice Check if an action is allowed |
| 13 | /// @param paymentInfo The payment information |
| 14 | /// @param caller The address attempting the action |
| 15 | /// @return allowed True if the action is allowed |
| 16 | function check(AuthCaptureEscrow.PaymentInfo calldata paymentInfo, address caller) |
| 17 | external |
| 18 | view |
| 19 | returns (bool allowed); |
| 20 | } |
| 21 |
0.0%
src/commerce-payments/conditions/IRecorder.sol
Lines covered: 0 / 0 (0.0%)
| 1 | // SPDX-License-Identifier: BUSL-1.1 |
| 2 | // Copyright 2025-2026 Ali Abdoli and Vrajang Parikh |
| 3 | pragma solidity ^0.8.28; |
| 4 | |
| 5 | import {AuthCaptureEscrow} from "commerce-payments/AuthCaptureEscrow.sol"; |
| 6 | |
| 7 | /// @title IRecorder |
| 8 | /// @notice Interface for recording state after an action is executed |
| 9 | /// @dev Recorders are called after an action succeeds to update state |
| 10 | /// @dev Unlike conditions, recorders CAN modify state |
| 11 | interface IRecorder { |
| 12 | /// @notice Record state after an action is executed |
| 13 | /// @param paymentInfo The payment information |
| 14 | /// @param amount The amount involved in the action |
| 15 | /// @param caller The address that executed the action |
| 16 | function record(AuthCaptureEscrow.PaymentInfo calldata paymentInfo, uint256 amount, address caller) external; |
| 17 | } |
| 18 |
87.0%
src/commerce-payments/operator/PaymentOperatorFactory.sol
Lines covered: 67 / 77 (87.0%)
| 1 | // SPDX-License-Identifier: BUSL-1.1 |
| 2 | // CONTRACTS UNAUDITED: USE AT YOUR OWN RISK |
| 3 | pragma solidity ^0.8.28; |
| 4 | |
| 5 | import {Ownable} from "solady/auth/Ownable.sol"; |
| 6 | import {PaymentOperator} from "./arbitration/PaymentOperator.sol"; |
| 7 | import {ZeroAddress, ZeroAmount} from "../types/Errors.sol"; |
| 8 | import {OperatorDeployed} from "./types/Events.sol"; |
| 9 | |
| 10 | /** |
| 11 | * @title PaymentOperatorFactory |
| 12 | * @notice Factory contract that deploys PaymentOperator instances with pluggable conditions. |
| 13 | * Each unique configuration gets its own operator contract. |
| 14 | * |
| 15 | * @dev Condition Combinator Architecture: |
| 16 | * - Operators have 10 slots: 5 conditions (before checks) + 5 recorders (after state updates) |
| 17 | * - address(0) = default behavior (allow for conditions, no-op for recorders) |
| 18 | * - Conditions implement ICondition.check() -> returns bool (true = allowed) |
| 19 | * - Recorders implement IRecorder.record() -> updates state after action |
| 20 | * - Conditions can be composed using combinators (Or, And, Not) |
| 21 | * - Client signs ERC-3009 with operator in PaymentInfo, committing to all conditions |
| 22 | * - Factory owner controls fee settings on all deployed operators |
| 23 | * - Works with Base Commerce Payments as designed |
| 24 | * |
| 25 | * OWNERSHIP: Uses Solady's Ownable with built-in 2-step transfer for safety: |
| 26 | * 1. New owner calls requestOwnershipHandover() |
| 27 | * 2. Current owner calls completeOwnershipHandover(newOwner) within 48 hours |
| 28 | * This prevents accidental transfers to wrong addresses. |
| 29 | * |
| 30 | * PRODUCTION REQUIREMENT: Owner MUST be a multisig (e.g., Gnosis Safe) in production. |
| 31 | * Single EOA ownership is only acceptable for testing/development. |
| 32 | * Factory owner controls all deployed operators, so securing this is critical. |
| 33 | */ |
| 34 | contract PaymentOperatorFactory is Ownable { |
| 35 | /// @notice Configuration struct for deploying operators |
| 36 | struct OperatorConfig { |
| 37 | address feeRecipient; |
| 38 | address authorizeCondition; |
| 39 | address authorizeRecorder; |
| 40 | address chargeCondition; |
| 41 | address chargeRecorder; |
| 42 | address releaseCondition; |
| 43 | address releaseRecorder; |
| 44 | address refundInEscrowCondition; |
| 45 | address refundInEscrowRecorder; |
| 46 | address refundPostEscrowCondition; |
| 47 | address refundPostEscrowRecorder; |
| 48 | } |
| 49 | |
| 50 | // Immutable configuration shared by all deployed operators |
| 51 | address public immutable ESCROW; |
| 52 | address public immutable PROTOCOL_FEE_RECIPIENT; |
| 53 | uint256 public immutable MAX_TOTAL_FEE_RATE; |
| 54 | uint256 public immutable PROTOCOL_FEE_PERCENTAGE; |
| 55 | |
| 56 | // keccak256(config) => operator address |
| 57 | mapping(bytes32 => address) public operators; |
| 58 | |
| 59 | constructor( |
| 60 | address _escrow, |
| 61 | address _protocolFeeRecipient, |
| 62 | uint256 _maxTotalFeeRate, |
| 63 | uint256 _protocolFeePercentage, |
| 64 | address _owner |
| 65 | ) { |
| 66 | if (_escrow == address(0)) revert ZeroAddress(); |
| 67 | if (_protocolFeeRecipient == address(0)) revert ZeroAddress(); |
| 68 | if (_owner == address(0)) revert ZeroAddress(); |
| 69 | if (_maxTotalFeeRate == 0) revert ZeroAmount(); |
| 70 | _initializeOwner(_owner); |
| 71 | |
| 72 | ESCROW = _escrow; |
| 73 | PROTOCOL_FEE_RECIPIENT = _protocolFeeRecipient; |
| 74 | MAX_TOTAL_FEE_RATE = _maxTotalFeeRate; |
| 75 | PROTOCOL_FEE_PERCENTAGE = _protocolFeePercentage; |
| 76 | } |
| 77 | |
| 78 | /** |
| 79 | * @notice Get the operator address for a given configuration |
| 80 | * @param config The operator configuration |
| 81 | * @return operator The operator address (address(0) if not deployed) |
| 82 | */ |
| 83 | function getOperator(OperatorConfig calldata config) external view returns (address) { |
| 84 | bytes32 key = _computeKey(config); |
| 85 | return operators[key]; |
| 86 | } |
| 87 | |
| 88 | /** |
| 89 | * @notice Calculate the deterministic address for an operator |
| 90 | * @dev Uses CREATE2 formula: keccak256(0xff ++ address(this) ++ salt ++ keccak256(bytecode)) |
| 91 | */ |
| 92 | function computeAddress(OperatorConfig calldata config) external view returns (address operator) { |
| 93 | bytes32 key = _computeKey(config); |
| 94 | bytes memory bytecode = _getBytecode(config); |
| 95 | bytes32 bytecodeHash = keccak256(bytecode); |
| 96 | |
| 97 | return address(uint160(uint256(keccak256(abi.encodePacked(bytes1(0xff), address(this), key, bytecodeHash))))); |
| 98 | } |
| 99 | |
| 100 | /** |
| 101 | * @notice Deploy an operator with full configuration |
| 102 | * @dev Idempotent - returns existing operator if already deployed. |
| 103 | * Factory owner becomes the operator owner (controls fee settings). |
| 104 | * Uses CREATE2 for deterministic addresses. |
| 105 | * @param config The operator configuration |
| 106 | * @return operator The operator address |
| 107 | */ |
| 108 | function deployOperator(OperatorConfig calldata config) external returns (address operator) { |
| 109 | // ============ CHECKS ============ |
| 110 | if (config.feeRecipient == address(0)) revert ZeroAddress(); |
| 111 | |
| 112 | bytes32 key = _computeKey(config); |
| 113 | |
| 114 | // Return existing if already deployed (idempotent) |
| 115 | if (operators[key] != address(0)) { |
| 116 | return operators[key]; |
| 117 | } |
| 118 | |
| 119 | // ============ EFFECTS ============ |
| 120 | // Compute deterministic CREATE2 address before deployment (CEI pattern) |
| 121 | bytes memory bytecode = _getBytecode(config); |
| 122 | operator = address( |
| 123 | uint160(uint256(keccak256(abi.encodePacked(bytes1(0xff), address(this), key, keccak256(bytecode))))) |
| 124 | ); |
| 125 | |
| 126 | // Store before external interaction |
| 127 | operators[key] = operator; |
| 128 | |
| 129 | emit OperatorDeployed(operator, config.feeRecipient, config.releaseCondition); |
| 130 | |
| 131 | // ============ INTERACTIONS ============ |
| 132 | // Deploy new operator - address is deterministic via CREATE2 |
| 133 | PaymentOperator.ConditionConfig memory conditions = PaymentOperator.ConditionConfig({ |
| 134 | authorizeCondition: config.authorizeCondition, |
| 135 | authorizeRecorder: config.authorizeRecorder, |
| 136 | chargeCondition: config.chargeCondition, |
| 137 | chargeRecorder: config.chargeRecorder, |
| 138 | releaseCondition: config.releaseCondition, |
| 139 | releaseRecorder: config.releaseRecorder, |
| 140 | refundInEscrowCondition: config.refundInEscrowCondition, |
| 141 | refundInEscrowRecorder: config.refundInEscrowRecorder, |
| 142 | refundPostEscrowCondition: config.refundPostEscrowCondition, |
| 143 | refundPostEscrowRecorder: config.refundPostEscrowRecorder |
| 144 | }); |
| 145 | address deployed = address( |
| 146 | new PaymentOperator{salt: key}( |
| 147 | ESCROW, |
| 148 | PROTOCOL_FEE_RECIPIENT, |
| 149 | MAX_TOTAL_FEE_RATE, |
| 150 | PROTOCOL_FEE_PERCENTAGE, |
| 151 | config.feeRecipient, |
| 152 | owner(), |
| 153 | conditions |
| 154 | ) |
| 155 | ); |
| 156 | |
| 157 | // Sanity check - CREATE2 address must match |
| 158 | assert(deployed == operator); |
| 159 | |
| 160 | return operator; |
| 161 | } |
| 162 | |
| 163 | /// @notice Rescue any ETH accidentally sent to this contract |
| 164 | /// @dev Solady's Ownable has payable functions; this allows recovery of any stuck ETH |
| 165 | function rescueETH() external onlyOwner { |
| 166 | uint256 balance = address(this).balance; |
| 167 | if (balance > 0) { |
| 168 | (bool success,) = msg.sender.call{value: balance}(""); |
| 169 | require(success); |
| 170 | } |
| 171 | } |
| 172 | |
| 173 | // ============ Internal Helpers ============ |
| 174 | |
| 175 | function _computeKey(OperatorConfig memory config) internal pure returns (bytes32) { |
| 176 | return keccak256( |
| 177 | abi.encodePacked( |
| 178 | config.feeRecipient, |
| 179 | config.authorizeCondition, |
| 180 | config.authorizeRecorder, |
| 181 | config.chargeCondition, |
| 182 | config.chargeRecorder, |
| 183 | config.releaseCondition, |
| 184 | config.releaseRecorder, |
| 185 | config.refundInEscrowCondition, |
| 186 | config.refundInEscrowRecorder, |
| 187 | config.refundPostEscrowCondition, |
| 188 | config.refundPostEscrowRecorder |
| 189 | ) |
| 190 | ); |
| 191 | } |
| 192 | |
| 193 | function _getBytecode(OperatorConfig memory config) internal view returns (bytes memory) { |
| 194 | // Create the ConditionConfig struct for encoding |
| 195 | PaymentOperator.ConditionConfig memory conditions = PaymentOperator.ConditionConfig({ |
| 196 | authorizeCondition: config.authorizeCondition, |
| 197 | authorizeRecorder: config.authorizeRecorder, |
| 198 | chargeCondition: config.chargeCondition, |
| 199 | chargeRecorder: config.chargeRecorder, |
| 200 | releaseCondition: config.releaseCondition, |
| 201 | releaseRecorder: config.releaseRecorder, |
| 202 | refundInEscrowCondition: config.refundInEscrowCondition, |
| 203 | refundInEscrowRecorder: config.refundInEscrowRecorder, |
| 204 | refundPostEscrowCondition: config.refundPostEscrowCondition, |
| 205 | refundPostEscrowRecorder: config.refundPostEscrowRecorder |
| 206 | }); |
| 207 | |
| 208 | return abi.encodePacked( |
| 209 | type(PaymentOperator).creationCode, |
| 210 | abi.encode( |
| 211 | ESCROW, |
| 212 | PROTOCOL_FEE_RECIPIENT, |
| 213 | MAX_TOTAL_FEE_RATE, |
| 214 | PROTOCOL_FEE_PERCENTAGE, |
| 215 | config.feeRecipient, |
| 216 | owner(), |
| 217 | conditions |
| 218 | ) |
| 219 | ); |
| 220 | } |
| 221 | } |
| 222 |
34.0%
src/commerce-payments/operator/arbitration/PaymentOperator.sol
Lines covered: 46 / 132 (34.0%)
| 1 | // SPDX-License-Identifier: BUSL-1.1 |
| 2 | // CONTRACTS UNAUDITED: USE AT YOUR OWN RISK |
| 3 | pragma solidity ^0.8.28; |
| 4 | |
| 5 | import {Ownable} from "solady/auth/Ownable.sol"; |
| 6 | import {SafeTransferLib} from "solady/utils/SafeTransferLib.sol"; |
| 7 | import {ReentrancyGuardTransient} from "solady/utils/ReentrancyGuardTransient.sol"; |
| 8 | import {AuthCaptureEscrow} from "commerce-payments/AuthCaptureEscrow.sol"; |
| 9 | import {PaymentOperatorAccess} from "./PaymentOperatorAccess.sol"; |
| 10 | import {ZeroAddress, ZeroAmount} from "../../types/Errors.sol"; |
| 11 | import {ZeroEscrow} from "../types/Errors.sol"; |
| 12 | import { |
| 13 | TotalFeeRateExceedsMax, |
| 14 | InvalidFeeBps, |
| 15 | InvalidFeeReceiver, |
| 16 | ETHTransferFailed, |
| 17 | ConditionNotMet, |
| 18 | TimelockNotElapsed, |
| 19 | NoPendingChange |
| 20 | } from "../types/Errors.sol"; |
| 21 | import {IOperator} from "../types/IOperator.sol"; |
| 22 | import {ICondition} from "../../conditions/ICondition.sol"; |
| 23 | import {IRecorder} from "../../conditions/IRecorder.sol"; |
| 24 | import {PaymentState} from "../types/Types.sol"; |
| 25 | import { |
| 26 | AuthorizationCreated, |
| 27 | ChargeExecuted, |
| 28 | ReleaseExecuted, |
| 29 | RefundExecuted, |
| 30 | ProtocolFeesEnabledUpdated, |
| 31 | FeesEnabledChangeQueued, |
| 32 | FeesEnabledChangeCancelled, |
| 33 | FeesDistributed |
| 34 | } from "../types/Events.sol"; |
| 35 | |
| 36 | /** |
| 37 | * @title PaymentOperator |
| 38 | * @notice Generic operator contract with pluggable conditions for flexible payment authorization. |
| 39 | * Supports marketplace escrow, subscriptions, streaming, grants, and any custom payment flow. |
| 40 | * |
| 41 | * @dev Condition Combinator Architecture: |
| 42 | * - Operator controls flow, conditions and recorders are composable plugins |
| 43 | * - 10 slots: 5 conditions (before checks) + 5 recorders (after state updates) |
| 44 | * - address(0) = default behavior (allow for conditions, no-op for recorders) |
| 45 | * - Conditions implement ICondition.check() -> returns bool (true = allowed) |
| 46 | * - Recorders implement IRecorder.record() -> updates state after action |
| 47 | * - Conditions can be composed using combinators (Or, And, Not) |
| 48 | * |
| 49 | * Slots: |
| 50 | * - AUTHORIZE_CONDITION / AUTHORIZE_RECORDER |
| 51 | * - CHARGE_CONDITION / CHARGE_RECORDER |
| 52 | * - RELEASE_CONDITION / RELEASE_RECORDER |
| 53 | * - REFUND_IN_ESCROW_CONDITION / REFUND_IN_ESCROW_RECORDER |
| 54 | * - REFUND_POST_ESCROW_CONDITION / REFUND_POST_ESCROW_RECORDER |
| 55 | * |
| 56 | * Flow for each action: |
| 57 | * User -> operator.action() -> [condition.check()?] -> escrow -> [recorder.record()?] |
| 58 | * |
| 59 | * ARCHITECTURE: Implements IOperator. Users call operator methods directly: |
| 60 | * User -> operator.authorize() -> escrow.authorize() |
| 61 | * User -> operator.charge() -> escrow.charge() |
| 62 | * User -> operator.release() -> escrow.capture() |
| 63 | * |
| 64 | * OWNERSHIP: Uses Solady's Ownable with built-in 2-step transfer for safety: |
| 65 | * 1. New owner calls requestOwnershipHandover() |
| 66 | * 2. Current owner calls completeOwnershipHandover(newOwner) within 48 hours |
| 67 | * This prevents accidental transfers to wrong addresses. |
| 68 | * |
| 69 | * PRODUCTION REQUIREMENT: Owner MUST be a multisig (e.g., Gnosis Safe) in production. |
| 70 | * Single EOA ownership is only acceptable for testing/development. |
| 71 | */ |
| 72 | contract PaymentOperator is Ownable, ReentrancyGuardTransient, PaymentOperatorAccess, IOperator { |
| 73 | /// @notice Configuration struct for condition/recorder slots |
| 74 | struct ConditionConfig { |
| 75 | address authorizeCondition; |
| 76 | address authorizeRecorder; |
| 77 | address chargeCondition; |
| 78 | address chargeRecorder; |
| 79 | address releaseCondition; |
| 80 | address releaseRecorder; |
| 81 | address refundInEscrowCondition; |
| 82 | address refundInEscrowRecorder; |
| 83 | address refundPostEscrowCondition; |
| 84 | address refundPostEscrowRecorder; |
| 85 | } |
| 86 | |
| 87 | // ============ Core State ============ |
| 88 | AuthCaptureEscrow public immutable ESCROW; |
| 89 | address public immutable FEE_RECIPIENT; |
| 90 | mapping(bytes32 => AuthCaptureEscrow.PaymentInfo) public paymentInfos; |
| 91 | |
| 92 | // Payment indexing for discoverability |
| 93 | mapping(address => bytes32[]) private payerPayments; |
| 94 | mapping(address => bytes32[]) private receiverPayments; |
| 95 | |
| 96 | // ============ Fee Configuration ============ |
| 97 | uint256 public constant BASIS_POINTS = 10000; |
| 98 | uint256 public immutable MAX_TOTAL_FEE_RATE; |
| 99 | uint256 public immutable PROTOCOL_FEE_PERCENTAGE; |
| 100 | uint256 public immutable MAX_OPERATOR_FEE_RATE; |
| 101 | |
| 102 | // ============ Condition Slots (before-action checks) ============ |
| 103 | // address(0) = always allow (default behavior) |
| 104 | ICondition public immutable AUTHORIZE_CONDITION; |
| 105 | ICondition public immutable CHARGE_CONDITION; |
| 106 | ICondition public immutable RELEASE_CONDITION; |
| 107 | ICondition public immutable REFUND_IN_ESCROW_CONDITION; |
| 108 | ICondition public immutable REFUND_POST_ESCROW_CONDITION; |
| 109 | |
| 110 | // ============ Recorder Slots (after-action state updates) ============ |
| 111 | // address(0) = no-op (default behavior) |
| 112 | IRecorder public immutable AUTHORIZE_RECORDER; |
| 113 | IRecorder public immutable CHARGE_RECORDER; |
| 114 | IRecorder public immutable RELEASE_RECORDER; |
| 115 | IRecorder public immutable REFUND_IN_ESCROW_RECORDER; |
| 116 | IRecorder public immutable REFUND_POST_ESCROW_RECORDER; |
| 117 | |
| 118 | address public immutable protocolFeeRecipient; |
| 119 | bool public feesEnabled; |
| 120 | |
| 121 | // ============ Timelock for Fee Changes ============ |
| 122 | /// @notice Delay before fee changes take effect (24 hours) |
| 123 | uint256 public constant TIMELOCK_DELAY = 24 hours; |
| 124 | /// @notice Pending fee enabled state (only valid if pendingFeesEnabledTimestamp > 0) |
| 125 | bool public pendingFeesEnabled; |
| 126 | /// @notice Timestamp when pending fee change can be executed (0 = no pending change) |
| 127 | uint256 public pendingFeesEnabledTimestamp; |
| 128 | |
| 129 | constructor( |
| 130 | address _escrow, |
| 131 | address _protocolFeeRecipient, |
| 132 | uint256 _maxTotalFeeRate, |
| 133 | uint256 _protocolFeePercentage, |
| 134 | address _feeRecipient, |
| 135 | address _owner, |
| 136 | ConditionConfig memory _conditions |
| 137 | ) { |
| 138 | if (_escrow == address(0)) revert ZeroEscrow(); |
| 139 | if (_feeRecipient == address(0)) revert ZeroAddress(); |
| 140 | ESCROW = AuthCaptureEscrow(_escrow); |
| 141 | FEE_RECIPIENT = _feeRecipient; |
| 142 | if (_protocolFeeRecipient == address(0)) revert ZeroAddress(); |
| 143 | if (_owner == address(0)) revert ZeroAddress(); |
| 144 | _initializeOwner(_owner); |
| 145 | if (_maxTotalFeeRate == 0) revert ZeroAmount(); |
| 146 | if (_protocolFeePercentage > 100) revert TotalFeeRateExceedsMax(); |
| 147 | |
| 148 | protocolFeeRecipient = _protocolFeeRecipient; |
| 149 | feesEnabled = false; |
| 150 | |
| 151 | MAX_TOTAL_FEE_RATE = _maxTotalFeeRate; |
| 152 | PROTOCOL_FEE_PERCENTAGE = _protocolFeePercentage; |
| 153 | MAX_OPERATOR_FEE_RATE = (_maxTotalFeeRate * (100 - _protocolFeePercentage)) / 100; |
| 154 | |
| 155 | // Set condition slots (address(0) = always allow) |
| 156 | AUTHORIZE_CONDITION = ICondition(_conditions.authorizeCondition); |
| 157 | CHARGE_CONDITION = ICondition(_conditions.chargeCondition); |
| 158 | RELEASE_CONDITION = ICondition(_conditions.releaseCondition); |
| 159 | REFUND_IN_ESCROW_CONDITION = ICondition(_conditions.refundInEscrowCondition); |
| 160 | REFUND_POST_ESCROW_CONDITION = ICondition(_conditions.refundPostEscrowCondition); |
| 161 | |
| 162 | // Set recorder slots (address(0) = no-op) |
| 163 | AUTHORIZE_RECORDER = IRecorder(_conditions.authorizeRecorder); |
| 164 | CHARGE_RECORDER = IRecorder(_conditions.chargeRecorder); |
| 165 | RELEASE_RECORDER = IRecorder(_conditions.releaseRecorder); |
| 166 | REFUND_IN_ESCROW_RECORDER = IRecorder(_conditions.refundInEscrowRecorder); |
| 167 | REFUND_POST_ESCROW_RECORDER = IRecorder(_conditions.refundPostEscrowRecorder); |
| 168 | } |
| 169 | |
| 170 | // ============ Owner Functions (Timelocked) ============ |
| 171 | |
| 172 | /** |
| 173 | * @notice Queue a change to protocol fees enabled state |
| 174 | * @dev Change takes effect after TIMELOCK_DELAY (24 hours) |
| 175 | * @param enabled New fees enabled state |
| 176 | */ |
| 177 | function queueFeesEnabled(bool enabled) external onlyOwner { |
| 178 | pendingFeesEnabled = enabled; |
| 179 | pendingFeesEnabledTimestamp = block.timestamp + TIMELOCK_DELAY; |
| 180 | emit FeesEnabledChangeQueued(enabled, pendingFeesEnabledTimestamp); |
| 181 | } |
| 182 | |
| 183 | /** |
| 184 | * @notice Execute a queued fee change after timelock delay |
| 185 | * @dev Reverts if no pending change or timelock not elapsed |
| 186 | */ |
| 187 | function executeFeesEnabled() external onlyOwner { |
| 188 | if (pendingFeesEnabledTimestamp == 0) revert NoPendingChange(); |
| 189 | if (block.timestamp < pendingFeesEnabledTimestamp) revert TimelockNotElapsed(); |
| 190 | |
| 191 | feesEnabled = pendingFeesEnabled; |
| 192 | pendingFeesEnabledTimestamp = 0; |
| 193 | emit ProtocolFeesEnabledUpdated(feesEnabled); |
| 194 | } |
| 195 | |
| 196 | /** |
| 197 | * @notice Cancel a pending fee change |
| 198 | */ |
| 199 | function cancelFeesEnabled() external onlyOwner { |
| 200 | if (pendingFeesEnabledTimestamp == 0) revert NoPendingChange(); |
| 201 | pendingFeesEnabledTimestamp = 0; |
| 202 | emit FeesEnabledChangeCancelled(); |
| 203 | } |
| 204 | |
| 205 | // ============ Payment Functions ============ |
| 206 | |
| 207 | /** |
| 208 | * @notice Authorize payment via Base Commerce Payments escrow |
| 209 | * @dev Checks AUTHORIZE_CONDITION, performs authorization, then calls AUTHORIZE_RECORDER |
| 210 | * @param paymentInfo PaymentInfo struct with required values: |
| 211 | * - operator == address(this) |
| 212 | * - minFeeBps == maxFeeBps == MAX_TOTAL_FEE_RATE |
| 213 | * - feeReceiver == address(this) |
| 214 | * authorizationExpiry can be set to any value (use type(uint48).max for no expiry) |
| 215 | * @param amount Amount to authorize |
| 216 | * @param tokenCollector Address of the token collector |
| 217 | * @param collectorData Data to pass to the token collector |
| 218 | */ |
| 219 | function authorize( |
| 220 | AuthCaptureEscrow.PaymentInfo calldata paymentInfo, |
| 221 | uint256 amount, |
| 222 | address tokenCollector, |
| 223 | bytes calldata collectorData |
| 224 | ) external nonReentrant validOperator(paymentInfo) validFees(paymentInfo, MAX_TOTAL_FEE_RATE) { |
| 225 | // ============ CHECKS ============ |
| 226 | // Check AUTHORIZE_CONDITION (address(0) = always allow) |
| 227 | if (address(AUTHORIZE_CONDITION) != address(0)) { |
| 228 | if (!AUTHORIZE_CONDITION.check(paymentInfo, msg.sender)) { |
| 229 | revert ConditionNotMet(); |
| 230 | } |
| 231 | } |
| 232 | |
| 233 | // ============ EFFECTS ============ |
| 234 | // Compute hash and update state before external call (CEI pattern) |
| 235 | bytes32 paymentInfoHash = ESCROW.getHash(paymentInfo); |
| 236 | paymentInfos[paymentInfoHash] = paymentInfo; |
| 237 | _addPayerPayment(paymentInfo.payer, paymentInfoHash); |
| 238 | _addReceiverPayment(paymentInfo.receiver, paymentInfoHash); |
| 239 | |
| 240 | // Emit event before external calls (CEI pattern) |
| 241 | emit AuthorizationCreated(paymentInfoHash, paymentInfo.payer, paymentInfo.receiver, amount, block.timestamp); |
| 242 | |
| 243 | // ============ INTERACTIONS ============ |
| 244 | ESCROW.authorize(paymentInfo, amount, tokenCollector, collectorData); |
| 245 | |
| 246 | // Call AUTHORIZE_RECORDER (address(0) = no-op) |
| 247 | if (address(AUTHORIZE_RECORDER) != address(0)) { |
| 248 | AUTHORIZE_RECORDER.record(paymentInfo, amount, msg.sender); |
| 249 | } |
| 250 | } |
| 251 | |
| 252 | /** |
| 253 | * @notice Direct charge - collects payment and immediately transfers to receiver |
| 254 | * @dev Checks CHARGE_CONDITION, performs charge, then calls CHARGE_RECORDER. |
| 255 | * Unlike authorize(), funds go directly to receiver (no escrow hold). |
| 256 | * Refunds are only possible via refundPostEscrow(). |
| 257 | * @param paymentInfo PaymentInfo struct with required values: |
| 258 | * - operator == address(this) |
| 259 | * - minFeeBps == maxFeeBps == MAX_TOTAL_FEE_RATE |
| 260 | * - feeReceiver == address(this) |
| 261 | * @param amount Amount to charge |
| 262 | * @param tokenCollector Address of the token collector |
| 263 | * @param collectorData Data to pass to the token collector |
| 264 | */ |
| 265 | function charge( |
| 266 | AuthCaptureEscrow.PaymentInfo calldata paymentInfo, |
| 267 | uint256 amount, |
| 268 | address tokenCollector, |
| 269 | bytes calldata collectorData |
| 270 | ) external nonReentrant validOperator(paymentInfo) validFees(paymentInfo, MAX_TOTAL_FEE_RATE) { |
| 271 | // ============ CHECKS ============ |
| 272 | // Check CHARGE_CONDITION (address(0) = always allow) |
| 273 | if (address(CHARGE_CONDITION) != address(0)) { |
| 274 | if (!CHARGE_CONDITION.check(paymentInfo, msg.sender)) { |
| 275 | revert ConditionNotMet(); |
| 276 | } |
| 277 | } |
| 278 | |
| 279 | uint16 feeBps = uint16(MAX_TOTAL_FEE_RATE); |
| 280 | address feeReceiver = address(this); |
| 281 | |
| 282 | // ============ EFFECTS ============ |
| 283 | // Compute hash and update state before external call (CEI pattern) |
| 284 | bytes32 paymentInfoHash = ESCROW.getHash(paymentInfo); |
| 285 | paymentInfos[paymentInfoHash] = paymentInfo; |
| 286 | _addPayerPayment(paymentInfo.payer, paymentInfoHash); |
| 287 | _addReceiverPayment(paymentInfo.receiver, paymentInfoHash); |
| 288 | |
| 289 | // Emit event before external calls (CEI pattern) |
| 290 | emit ChargeExecuted(paymentInfoHash, paymentInfo.payer, paymentInfo.receiver, amount, block.timestamp); |
| 291 | |
| 292 | // ============ INTERACTIONS ============ |
| 293 | ESCROW.charge(paymentInfo, amount, tokenCollector, collectorData, feeBps, feeReceiver); |
| 294 | |
| 295 | // Call CHARGE_RECORDER (address(0) = no-op) |
| 296 | if (address(CHARGE_RECORDER) != address(0)) { |
| 297 | CHARGE_RECORDER.record(paymentInfo, amount, msg.sender); |
| 298 | } |
| 299 | } |
| 300 | |
| 301 | /** |
| 302 | * @notice Release funds to receiver |
| 303 | * @dev Checks RELEASE_CONDITION, performs capture, then calls RELEASE_RECORDER |
| 304 | * @param paymentInfo PaymentInfo struct |
| 305 | * @param amount Amount to release |
| 306 | */ |
| 307 | function release(AuthCaptureEscrow.PaymentInfo calldata paymentInfo, uint256 amount) |
| 308 | external |
| 309 | nonReentrant |
| 310 | validOperator(paymentInfo) |
| 311 | { |
| 312 | // ============ CHECKS ============ |
| 313 | // Check RELEASE_CONDITION (address(0) = always allow) |
| 314 | if (address(RELEASE_CONDITION) != address(0)) { |
| 315 | if (!RELEASE_CONDITION.check(paymentInfo, msg.sender)) { |
| 316 | revert ConditionNotMet(); |
| 317 | } |
| 318 | } |
| 319 | |
| 320 | uint16 feeBps = uint16(MAX_TOTAL_FEE_RATE); |
| 321 | address feeReceiver = address(this); |
| 322 | |
| 323 | // ============ EFFECTS ============ |
| 324 | // Emit event before external calls (CEI pattern) |
| 325 | emit ReleaseExecuted(paymentInfo, amount, block.timestamp); |
| 326 | |
| 327 | // ============ INTERACTIONS ============ |
| 328 | // Forward to escrow - escrow validates payment exists |
| 329 | ESCROW.capture(paymentInfo, amount, feeBps, feeReceiver); |
| 330 | |
| 331 | // Call RELEASE_RECORDER (address(0) = no-op) |
| 332 | if (address(RELEASE_RECORDER) != address(0)) { |
| 333 | RELEASE_RECORDER.record(paymentInfo, amount, msg.sender); |
| 334 | } |
| 335 | } |
| 336 | |
| 337 | /** |
| 338 | * @notice Refund funds while still in escrow (before capture) |
| 339 | * @dev Checks REFUND_IN_ESCROW_CONDITION, performs partialVoid, then calls REFUND_IN_ESCROW_RECORDER |
| 340 | * Typically receiver or arbiter can call (controlled via condition). |
| 341 | * @param paymentInfo PaymentInfo struct |
| 342 | * @param amount Amount to return to payer |
| 343 | */ |
| 344 | function refundInEscrow(AuthCaptureEscrow.PaymentInfo calldata paymentInfo, uint120 amount) |
| 345 | external |
| 346 | nonReentrant |
| 347 | validOperator(paymentInfo) |
| 348 | { |
| 349 | // ============ CHECKS ============ |
| 350 | // Check REFUND_IN_ESCROW_CONDITION (address(0) = always allow) |
| 351 | if (address(REFUND_IN_ESCROW_CONDITION) != address(0)) { |
| 352 | if (!REFUND_IN_ESCROW_CONDITION.check(paymentInfo, msg.sender)) { |
| 353 | revert ConditionNotMet(); |
| 354 | } |
| 355 | } |
| 356 | |
| 357 | // ============ EFFECTS ============ |
| 358 | // Emit event before external calls (CEI pattern) |
| 359 | emit RefundExecuted(paymentInfo, paymentInfo.payer, amount); |
| 360 | |
| 361 | // ============ INTERACTIONS ============ |
| 362 | // Forward to escrow's partialVoid - escrow validates payment exists |
| 363 | ESCROW.partialVoid(paymentInfo, amount); |
| 364 | |
| 365 | // Call REFUND_IN_ESCROW_RECORDER (address(0) = no-op) |
| 366 | if (address(REFUND_IN_ESCROW_RECORDER) != address(0)) { |
| 367 | REFUND_IN_ESCROW_RECORDER.record(paymentInfo, amount, msg.sender); |
| 368 | } |
| 369 | } |
| 370 | |
| 371 | /** |
| 372 | * @notice Refund captured funds back to payer (after capture/release) |
| 373 | * @dev Checks REFUND_POST_ESCROW_CONDITION, performs refund, then calls REFUND_POST_ESCROW_RECORDER |
| 374 | * Permission is enforced by the token collector (e.g., receiver must have approved it, |
| 375 | * or collectorData contains receiver's signature). Anyone can call, but refund only |
| 376 | * succeeds if the token collector can source the funds. |
| 377 | * @param paymentInfo PaymentInfo struct |
| 378 | * @param amount Amount to refund to payer |
| 379 | * @param tokenCollector Address of the token collector that will source the refund |
| 380 | * @param collectorData Data to pass to the token collector (e.g., signatures) |
| 381 | */ |
| 382 | function refundPostEscrow( |
| 383 | AuthCaptureEscrow.PaymentInfo calldata paymentInfo, |
| 384 | uint256 amount, |
| 385 | address tokenCollector, |
| 386 | bytes calldata collectorData |
| 387 | ) external nonReentrant validOperator(paymentInfo) { |
| 388 | // ============ CHECKS ============ |
| 389 | // Check REFUND_POST_ESCROW_CONDITION (address(0) = always allow) |
| 390 | if (address(REFUND_POST_ESCROW_CONDITION) != address(0)) { |
| 391 | if (!REFUND_POST_ESCROW_CONDITION.check(paymentInfo, msg.sender)) { |
| 392 | revert ConditionNotMet(); |
| 393 | } |
| 394 | } |
| 395 | |
| 396 | // ============ EFFECTS ============ |
| 397 | // Emit event before external calls (CEI pattern) |
| 398 | emit RefundExecuted(paymentInfo, paymentInfo.payer, uint120(amount)); |
| 399 | |
| 400 | // ============ INTERACTIONS ============ |
| 401 | // Forward to escrow's refund - token collector enforces permission |
| 402 | ESCROW.refund(paymentInfo, amount, tokenCollector, collectorData); |
| 403 | |
| 404 | // Call REFUND_POST_ESCROW_RECORDER (address(0) = no-op) |
| 405 | if (address(REFUND_POST_ESCROW_RECORDER) != address(0)) { |
| 406 | REFUND_POST_ESCROW_RECORDER.record(paymentInfo, amount, msg.sender); |
| 407 | } |
| 408 | } |
| 409 | |
| 410 | /** |
| 411 | * @notice Distribute collected fees to protocol and arbiter |
| 412 | * @param token The token address to distribute fees for |
| 413 | */ |
| 414 | function distributeFees(address token) external { |
| 415 | // ============ CHECKS ============ |
| 416 | if (token == address(0)) revert ZeroAddress(); |
| 417 | uint256 balance = SafeTransferLib.balanceOf(token, address(this)); |
| 418 | if (balance == 0) return; |
| 419 | |
| 420 | uint256 protocolAmount = 0; |
| 421 | uint256 operatorAmount = 0; |
| 422 | |
| 423 | if (feesEnabled) { |
| 424 | protocolAmount = (balance * PROTOCOL_FEE_PERCENTAGE) / 100; |
| 425 | operatorAmount = balance - protocolAmount; |
| 426 | } else { |
| 427 | operatorAmount = balance; |
| 428 | } |
| 429 | |
| 430 | // ============ EFFECTS ============ |
| 431 | // Emit event before external calls (CEI pattern) |
| 432 | emit FeesDistributed(token, protocolAmount, operatorAmount); |
| 433 | |
| 434 | // ============ INTERACTIONS ============ |
| 435 | if (protocolAmount > 0) { |
| 436 | SafeTransferLib.safeTransfer(token, protocolFeeRecipient, protocolAmount); |
| 437 | } |
| 438 | |
| 439 | if (operatorAmount > 0) { |
| 440 | SafeTransferLib.safeTransfer(token, FEE_RECIPIENT, operatorAmount); |
| 441 | } |
| 442 | } |
| 443 | |
| 444 | /// @notice Rescue any ETH accidentally sent to this contract |
| 445 | /// @dev Solady's Ownable has payable functions; this allows recovery of any stuck ETH |
| 446 | function rescueETH() external onlyOwner { |
| 447 | uint256 balance = address(this).balance; |
| 448 | if (balance > 0) { |
| 449 | (bool success,) = msg.sender.call{value: balance}(""); |
| 450 | if (!success) revert ETHTransferFailed(); |
| 451 | } |
| 452 | } |
| 453 | |
| 454 | // ============ View Functions ============ |
| 455 | |
| 456 | /** |
| 457 | * @notice Check if a payment exists (has been authorized) |
| 458 | * @param paymentInfoHash The hash of the PaymentInfo |
| 459 | * @return True if payment exists |
| 460 | */ |
| 461 | function paymentExists(bytes32 paymentInfoHash) public view returns (bool) { |
| 462 | return paymentInfos[paymentInfoHash].payer != address(0); |
| 463 | } |
| 464 | |
| 465 | /** |
| 466 | * @notice Get stored PaymentInfo for a given hash |
| 467 | * @param paymentInfoHash The hash of the PaymentInfo |
| 468 | * @return The stored PaymentInfo struct |
| 469 | */ |
| 470 | function getPaymentInfo(bytes32 paymentInfoHash) public view returns (AuthCaptureEscrow.PaymentInfo memory) { |
| 471 | return paymentInfos[paymentInfoHash]; |
| 472 | } |
| 473 | |
| 474 | /** |
| 475 | * @notice Check if payment is in escrow (has capturable amount) |
| 476 | * @param paymentInfoHash The hash of the PaymentInfo |
| 477 | * @return True if payment is in escrow |
| 478 | */ |
| 479 | function isInEscrow(bytes32 paymentInfoHash) public view returns (bool) { |
| 480 | (, uint120 capturableAmount,) = ESCROW.paymentState(paymentInfoHash); |
| 481 | return capturableAmount > 0; |
| 482 | } |
| 483 | |
| 484 | /** |
| 485 | * @notice Get the explicit state of a payment in its lifecycle |
| 486 | * @param paymentInfo The PaymentInfo struct |
| 487 | * @return state The current PaymentState enum value |
| 488 | * @dev See PaymentState enum for state machine documentation |
| 489 | * |
| 490 | * Escrow struct fields: |
| 491 | * - hasCollectedPayment: true if authorize() or charge() was called |
| 492 | * - capturableAmount: funds in escrow that can be captured (released) |
| 493 | * - refundableAmount: captured funds eligible for refund |
| 494 | */ |
| 495 | function getPaymentState(AuthCaptureEscrow.PaymentInfo calldata paymentInfo) |
| 496 | external |
| 497 | view |
| 498 | returns (PaymentState state) |
| 499 | { |
| 500 | bytes32 paymentInfoHash = ESCROW.getHash(paymentInfo); |
| 501 | |
| 502 | // Check if payment exists in this operator |
| 503 | if (paymentInfos[paymentInfoHash].payer == address(0)) { |
| 504 | return PaymentState.NonExistent; |
| 505 | } |
| 506 | |
| 507 | // Get escrow state |
| 508 | (bool hasCollectedPayment, uint120 capturableAmount, uint120 refundableAmount) = |
| 509 | ESCROW.paymentState(paymentInfoHash); |
| 510 | |
| 511 | // If never collected, shouldn't happen if exists in operator, but handle gracefully |
| 512 | if (!hasCollectedPayment) { |
| 513 | return PaymentState.NonExistent; |
| 514 | } |
| 515 | |
| 516 | // Check if expired (can be reclaimed) |
| 517 | if (capturableAmount > 0 && block.timestamp >= paymentInfo.authorizationExpiry) { |
| 518 | return PaymentState.Expired; |
| 519 | } |
| 520 | |
| 521 | // Determine state based on amounts |
| 522 | if (capturableAmount > 0) { |
| 523 | // Funds still in escrow, can be captured or voided |
| 524 | return PaymentState.InEscrow; |
| 525 | } else if (refundableAmount > 0) { |
| 526 | // Funds have been captured/released, still within refund window |
| 527 | return PaymentState.Released; |
| 528 | } else { |
| 529 | // No capturable and no refundable = payment is settled |
| 530 | // Could be: voided, fully refunded, or refund period expired |
| 531 | return PaymentState.Settled; |
| 532 | } |
| 533 | } |
| 534 | |
| 535 | /** |
| 536 | * @notice Get all payment hashes for a payer |
| 537 | * @param payer The payer address |
| 538 | * @return Array of payment info hashes |
| 539 | */ |
| 540 | function getPayerPayments(address payer) external view returns (bytes32[] memory) { |
| 541 | return payerPayments[payer]; |
| 542 | } |
| 543 | |
| 544 | /** |
| 545 | * @notice Get all payment hashes for a receiver (merchant) |
| 546 | * @param receiver The receiver address |
| 547 | * @return Array of payment info hashes |
| 548 | */ |
| 549 | function getReceiverPayments(address receiver) external view returns (bytes32[] memory) { |
| 550 | return receiverPayments[receiver]; |
| 551 | } |
| 552 | |
| 553 | // ============ Internal Helpers ============ |
| 554 | |
| 555 | /** |
| 556 | * @notice Add payment hash to payer's list |
| 557 | * @param payer The payer address |
| 558 | * @param hash The payment info hash |
| 559 | */ |
| 560 | function _addPayerPayment(address payer, bytes32 hash) internal { |
| 561 | payerPayments[payer].push(hash); |
| 562 | } |
| 563 | |
| 564 | /** |
| 565 | * @notice Add payment hash to receiver's list |
| 566 | * @param receiver The receiver address |
| 567 | * @param hash The payment info hash |
| 568 | */ |
| 569 | function _addReceiverPayment(address receiver, bytes32 hash) internal { |
| 570 | receiverPayments[receiver].push(hash); |
| 571 | } |
| 572 | } |
| 573 |
75.0%
src/commerce-payments/operator/arbitration/PaymentOperatorAccess.sol
Lines covered: 3 / 4 (75.0%)
| 1 | // SPDX-License-Identifier: BUSL-1.1 |
| 2 | // CONTRACTS UNAUDITED: USE AT YOUR OWN RISK |
| 3 | pragma solidity ^0.8.28; |
| 4 | |
| 5 | import {AuthCaptureEscrow} from "commerce-payments/AuthCaptureEscrow.sol"; |
| 6 | import {InvalidOperator} from "../../types/Errors.sol"; |
| 7 | import {InvalidFeeBps, InvalidFeeReceiver} from "../types/Errors.sol"; |
| 8 | |
| 9 | /** |
| 10 | * @title PaymentOperatorAccess |
| 11 | * @notice Stateless access control modifiers for PaymentOperator |
| 12 | * @dev Contains ONLY modifiers used by PaymentOperator itself. |
| 13 | * For RefundRequest-specific modifiers, see RefundRequestAccess. |
| 14 | */ |
| 15 | abstract contract PaymentOperatorAccess { |
| 16 | /** |
| 17 | * @notice Modifier to validate operator is this contract |
| 18 | * @dev Used by operator functions to ensure paymentInfo is for this operator |
| 19 | * @param paymentInfo The PaymentInfo struct |
| 20 | */ |
| 21 | modifier validOperator(AuthCaptureEscrow.PaymentInfo calldata paymentInfo) { |
| 22 | if (paymentInfo.operator != address(this)) revert InvalidOperator(); |
| 23 | _; |
| 24 | } |
| 25 | |
| 26 | /** |
| 27 | * @notice Modifier to validate fee configuration in PaymentInfo |
| 28 | * @dev Ensures minFeeBps == maxFeeBps == maxTotalFeeRate and feeReceiver == address(this) |
| 29 | * @param paymentInfo The PaymentInfo struct to validate |
| 30 | * @param maxTotalFeeRate The expected fee rate for both minFeeBps and maxFeeBps |
| 31 | */ |
| 32 | modifier validFees(AuthCaptureEscrow.PaymentInfo calldata paymentInfo, uint256 maxTotalFeeRate) { |
| 33 | if (paymentInfo.minFeeBps != maxTotalFeeRate || paymentInfo.maxFeeBps != maxTotalFeeRate) { |
| 34 | revert InvalidFeeBps(); |
| 35 | } |
| 36 | if (paymentInfo.feeReceiver != address(this)) revert InvalidFeeReceiver(); |
| 37 | _; |
| 38 | } |
| 39 | } |
| 40 |
0.0%
src/commerce-payments/operator/types/Errors.sol
Lines covered: 0 / 0 (0.0%)
| 1 | // SPDX-License-Identifier: BUSL-1.1 |
| 2 | // CONTRACTS UNAUDITED: USE AT YOUR OWN RISK |
| 3 | pragma solidity ^0.8.28; |
| 4 | |
| 5 | // ============ Operator-Specific Errors ============ |
| 6 | error ZeroEscrow(); |
| 7 | error TotalFeeRateExceedsMax(); |
| 8 | error ReleaseLocked(); |
| 9 | |
| 10 | // ============ PaymentInfo Validation Errors ============ |
| 11 | error InvalidFeeBps(); |
| 12 | error InvalidFeeReceiver(); |
| 13 | error UnauthorizedCaller(); |
| 14 | error ETHTransferFailed(); |
| 15 | |
| 16 | // ============ Condition Errors ============ |
| 17 | error ConditionNotMet(); |
| 18 | |
| 19 | // ============ Timelock Errors ============ |
| 20 | error TimelockNotElapsed(); |
| 21 | error NoPendingChange(); |
| 22 | |
| 23 |
0.0%
src/commerce-payments/operator/types/Events.sol
Lines covered: 0 / 0 (0.0%)
| 1 | // SPDX-License-Identifier: BUSL-1.1 |
| 2 | // CONTRACTS UNAUDITED: USE AT YOUR OWN RISK |
| 3 | pragma solidity ^0.8.28; |
| 4 | |
| 5 | import {AuthCaptureEscrow} from "commerce-payments/AuthCaptureEscrow.sol"; |
| 6 | |
| 7 | // ============ Arbitration Operator Events ============ |
| 8 | event AuthorizationCreated( |
| 9 | bytes32 indexed paymentInfoHash, address indexed payer, address indexed receiver, uint256 amount, uint256 timestamp |
| 10 | ); |
| 11 | |
| 12 | event ReleaseExecuted(AuthCaptureEscrow.PaymentInfo paymentInfo, uint256 amount, uint256 timestamp); |
| 13 | |
| 14 | event ChargeExecuted( |
| 15 | bytes32 indexed paymentInfoHash, address indexed payer, address indexed receiver, uint256 amount, uint256 timestamp |
| 16 | ); |
| 17 | |
| 18 | event RefundExecuted(AuthCaptureEscrow.PaymentInfo paymentInfo, address indexed payer, uint256 amount); |
| 19 | |
| 20 | event RefundAfterEscrowExecuted(AuthCaptureEscrow.PaymentInfo paymentInfo, address indexed payer, uint256 amount); |
| 21 | |
| 22 | event ProtocolFeesEnabledUpdated(bool enabled); |
| 23 | |
| 24 | event FeesEnabledChangeQueued(bool enabled, uint256 executeAfter); |
| 25 | event FeesEnabledChangeCancelled(); |
| 26 | |
| 27 | event FeesDistributed(address indexed token, uint256 protocolAmount, uint256 arbiterAmount); |
| 28 | |
| 29 | // ============ Factory Events ============ |
| 30 | event OperatorDeployed(address indexed operator, address indexed arbiter, address indexed releaseCondition); |
| 31 |
0.0%
src/commerce-payments/operator/types/IOperator.sol
Lines covered: 0 / 0 (0.0%)
| 1 | // SPDX-License-Identifier: BUSL-1.1 |
| 2 | // CONTRACTS UNAUDITED: USE AT YOUR OWN RISK |
| 3 | pragma solidity ^0.8.28; |
| 4 | |
| 5 | import {AuthCaptureEscrow} from "commerce-payments/AuthCaptureEscrow.sol"; |
| 6 | |
| 7 | /** |
| 8 | * @title IOperator |
| 9 | * @notice Interface for operator contracts that manage payment authorization and release |
| 10 | * @dev Operators are the intermediary between conditions and the escrow contract. |
| 11 | * They handle the business logic for payment flows while delegating fund custody to escrow. |
| 12 | * |
| 13 | * Typical flow: |
| 14 | * User -> ICondition.check() -> IOperator.release() -> Escrow.capture() |
| 15 | * User -> IOperator.authorize() -> Escrow.authorize() |
| 16 | */ |
| 17 | interface IOperator { |
| 18 | /** |
| 19 | * @notice Get the escrow contract address |
| 20 | * @return The AuthCaptureEscrow contract address |
| 21 | */ |
| 22 | function ESCROW() external view returns (AuthCaptureEscrow); |
| 23 | /** |
| 24 | * @notice Authorize a payment through the escrow |
| 25 | * @param paymentInfo PaymentInfo struct with payment details |
| 26 | * @param amount Amount to authorize |
| 27 | * @param tokenCollector Address of the token collector |
| 28 | * @param collectorData Data to pass to the token collector |
| 29 | */ |
| 30 | function authorize( |
| 31 | AuthCaptureEscrow.PaymentInfo calldata paymentInfo, |
| 32 | uint256 amount, |
| 33 | address tokenCollector, |
| 34 | bytes calldata collectorData |
| 35 | ) external; |
| 36 | |
| 37 | /** |
| 38 | * @notice Release funds to the receiver |
| 39 | * @param paymentInfo PaymentInfo struct |
| 40 | * @param amount Amount to release |
| 41 | */ |
| 42 | function release(AuthCaptureEscrow.PaymentInfo calldata paymentInfo, uint256 amount) external; |
| 43 | |
| 44 | /** |
| 45 | * @notice Refund funds while still in escrow (before capture) |
| 46 | * @param paymentInfo PaymentInfo struct |
| 47 | * @param amount Amount to return to payer |
| 48 | */ |
| 49 | function refundInEscrow(AuthCaptureEscrow.PaymentInfo calldata paymentInfo, uint120 amount) external; |
| 50 | |
| 51 | /** |
| 52 | * @notice Refund captured funds back to payer (after capture/release) |
| 53 | * @param paymentInfo PaymentInfo struct |
| 54 | * @param amount Amount to refund to payer |
| 55 | * @param tokenCollector Address of the token collector that will source the refund |
| 56 | * @param collectorData Data to pass to the token collector |
| 57 | */ |
| 58 | function refundPostEscrow( |
| 59 | AuthCaptureEscrow.PaymentInfo calldata paymentInfo, |
| 60 | uint256 amount, |
| 61 | address tokenCollector, |
| 62 | bytes calldata collectorData |
| 63 | ) external; |
| 64 | } |
| 65 |
0.0%
src/commerce-payments/operator/types/Types.sol
Lines covered: 0 / 0 (0.0%)
| 1 | // SPDX-License-Identifier: BUSL-1.1 |
| 2 | // CONTRACTS UNAUDITED: USE AT YOUR OWN RISK |
| 3 | pragma solidity ^0.8.28; |
| 4 | |
| 5 | /** |
| 6 | * @title PaymentState |
| 7 | * @notice Explicit payment lifecycle states for ArbitrationOperator |
| 8 | * |
| 9 | * STATE MACHINE: |
| 10 | * ============== |
| 11 | * |
| 12 | * ┌──────────────┐ authorize() ┌──────────────┐ release() ┌──────────────┐ |
| 13 | * │ NonExistent │ ────────────▶ │ InEscrow │ ──────────▶ │ Released │ |
| 14 | * └──────────────┘ └──────────────┘ └──────────────┘ |
| 15 | * │ │ |
| 16 | * │ │ |
| 17 | * void/reclaim │ refundPostEscrow (full) │ |
| 18 | * refundInEscrow│ or refundExpiry passed │ |
| 19 | * (full) │ │ |
| 20 | * ▼ ▼ |
| 21 | * ┌─────────────────────────────────────────┐ |
| 22 | * │ Settled │ |
| 23 | * │ (no funds in escrow or refundable) │ |
| 24 | * └─────────────────────────────────────────┘ |
| 25 | * |
| 26 | * TRANSITIONS: |
| 27 | * - NonExistent → InEscrow: authorize() |
| 28 | * - InEscrow → InEscrow: partial refundInEscrow() (reduces capturableAmount) |
| 29 | * - InEscrow → Released: release() / capture() |
| 30 | * - InEscrow → Settled: full refundInEscrow(), void(), or reclaim() |
| 31 | * - InEscrow → Expired: authorizationExpiry passed (payer can reclaim) |
| 32 | * - Released → Released: partial refundPostEscrow() (reduces refundableAmount) |
| 33 | * - Released → Settled: full refundPostEscrow() or refundExpiry passed |
| 34 | * - Expired → Settled: reclaim() called by payer |
| 35 | * |
| 36 | * FREEZE STATES (EscrowPeriodCondition only): |
| 37 | * - InEscrow can be frozen/unfrozen via condition.freeze()/unfreeze() |
| 38 | * - Frozen payments block release through condition (payer bypass still works) |
| 39 | * - Freeze state is tracked in EscrowPeriodCondition, not in escrow |
| 40 | * |
| 41 | * ESCROW FIELDS (from AuthCaptureEscrow.paymentState): |
| 42 | * - hasCollectedPayment: true if authorize() or charge() was called |
| 43 | * - capturableAmount: Funds in escrow that can be captured or voided |
| 44 | * - refundableAmount: Captured funds eligible for refund (within refundExpiry) |
| 45 | */ |
| 46 | enum PaymentState { |
| 47 | /// @notice Payment has never been authorized through this operator |
| 48 | NonExistent, |
| 49 | |
| 50 | /// @notice Payment authorized, funds locked in escrow (capturableAmount > 0) |
| 51 | InEscrow, |
| 52 | |
| 53 | /// @notice Funds released to receiver, may still be refundable (refundableAmount > 0) |
| 54 | Released, |
| 55 | |
| 56 | /// @notice Payment settled - no funds in escrow or refundable |
| 57 | /// @dev Could be: voided before capture, fully refunded, or refund period expired |
| 58 | /// Escrow doesn't track capture history, so these are indistinguishable |
| 59 | Settled, |
| 60 | |
| 61 | /// @notice Authorization expired, payer can reclaim via escrow.reclaim() |
| 62 | Expired |
| 63 | } |
| 64 |
0.0%
src/commerce-payments/types/Errors.sol
Lines covered: 0 / 0 (0.0%)
| 1 | // SPDX-License-Identifier: BUSL-1.1 |
| 2 | // CONTRACTS UNAUDITED: USE AT YOUR OWN RISK |
| 3 | pragma solidity ^0.8.28; |
| 4 | |
| 5 | // ============ Common Errors ============ |
| 6 | error ZeroAddress(); |
| 7 | error ZeroAmount(); |
| 8 | |
| 9 | // ============ Access Control Errors ============ |
| 10 | error NotReceiver(); |
| 11 | error NotPayer(); |
| 12 | error NotArbiter(); |
| 13 | error NotReceiverOrArbiter(); |
| 14 | error OnlyOperator(); |
| 15 | |
| 16 | // ============ Payment State Errors ============ |
| 17 | error PaymentDoesNotExist(); |
| 18 | error InvalidOperator(); |
| 19 | error NotInEscrow(); |
| 20 | error NotCaptured(); |
| 21 |
58.0%
test/invariants/PaymentOperatorInvariants.sol
Lines covered: 58 / 100 (58.0%)
| 1 | // SPDX-License-Identifier: MIT |
| 2 | pragma solidity ^0.8.28; |
| 3 | |
| 4 | import {Test} from "forge-std/Test.sol"; |
| 5 | import {PaymentOperator} from "../../src/commerce-payments/operator/arbitration/PaymentOperator.sol"; |
| 6 | import {PaymentOperatorFactory} from "../../src/commerce-payments/operator/PaymentOperatorFactory.sol"; |
| 7 | import {AuthCaptureEscrow} from "commerce-payments/AuthCaptureEscrow.sol"; |
| 8 | import {PreApprovalPaymentCollector} from "commerce-payments/collectors/PreApprovalPaymentCollector.sol"; |
| 9 | import {MockERC20} from "../mocks/MockERC20.sol"; |
| 10 | |
| 11 | /** |
| 12 | * @title PaymentOperatorInvariants |
| 13 | * @notice Echidna property-based testing for PaymentOperator |
| 14 | * @dev Verifies security properties P1-P23 via fuzzing |
| 15 | * |
| 16 | * Usage: |
| 17 | * echidna . --contract PaymentOperatorInvariants --config echidna.yaml |
| 18 | */ |
| 19 | contract PaymentOperatorInvariants is Test { |
| 20 | PaymentOperator public operator; |
| 21 | AuthCaptureEscrow public escrow; |
| 22 | PreApprovalPaymentCollector public collector; |
| 23 | MockERC20 public token; |
| 24 | |
| 25 | address public owner; |
| 26 | address public protocolFeeRecipient; |
| 27 | |
| 28 | // Track all payments for invariant checking |
| 29 | mapping(bytes32 => PaymentTracking) public payments; |
| 30 | bytes32[] public paymentHashes; |
| 31 | |
| 32 | struct PaymentTracking { |
| 33 | bool exists; |
| 34 | uint256 authorizedAmount; |
| 35 | uint256 capturedAmount; |
| 36 | uint256 refundedAmount; |
| 37 | address payer; |
| 38 | address receiver; |
| 39 | } |
| 40 | |
| 41 | uint256 public constant MAX_TOTAL_FEE_RATE = 50; // 0.5% |
| 42 | uint256 public constant PROTOCOL_FEE_PERCENTAGE = 25; |
| 43 | |
| 44 | constructor() { |
| 45 | owner = address(this); |
| 46 | protocolFeeRecipient = address(0x1234); |
| 47 | |
| 48 | // Deploy infrastructure |
| 49 | escrow = new AuthCaptureEscrow(); |
| 50 | token = new MockERC20("Test Token", "TEST"); |
| 51 | collector = new PreApprovalPaymentCollector(address(escrow)); |
| 52 | |
| 53 | // Deploy operator |
| 54 | PaymentOperatorFactory factory = new PaymentOperatorFactory( |
| 55 | address(escrow), protocolFeeRecipient, MAX_TOTAL_FEE_RATE, PROTOCOL_FEE_PERCENTAGE, owner |
| 56 | ); |
| 57 | |
| 58 | PaymentOperatorFactory.OperatorConfig memory config = PaymentOperatorFactory.OperatorConfig({ |
| 59 | feeRecipient: protocolFeeRecipient, |
| 60 | authorizeCondition: address(0), |
| 61 | authorizeRecorder: address(0), |
| 62 | chargeCondition: address(0), |
| 63 | chargeRecorder: address(0), |
| 64 | releaseCondition: address(0), |
| 65 | releaseRecorder: address(0), |
| 66 | refundInEscrowCondition: address(0), |
| 67 | refundInEscrowRecorder: address(0), |
| 68 | refundPostEscrowCondition: address(0), |
| 69 | refundPostEscrowRecorder: address(0) |
| 70 | }); |
| 71 | |
| 72 | operator = PaymentOperator(factory.deployOperator(config)); |
| 73 | |
| 74 | // Mint tokens for testing |
| 75 | token.mint(address(this), type(uint128).max); |
| 76 | token.approve(address(collector), type(uint256).max); |
| 77 | } |
| 78 | |
| 79 | // ============ Helper Functions ============ |
| 80 | |
| 81 | function _createPaymentInfo(address payer, address receiver, uint256 amount, uint256 salt) |
| 82 | internal |
| 83 | view |
| 84 | returns (AuthCaptureEscrow.PaymentInfo memory) |
| 85 | { |
| 86 | return AuthCaptureEscrow.PaymentInfo({ |
| 87 | operator: address(operator), |
| 88 | payer: payer, |
| 89 | receiver: receiver, |
| 90 | token: address(token), |
| 91 | maxAmount: uint120(amount), |
| 92 | preApprovalExpiry: uint48(block.timestamp + 1 days), |
| 93 | authorizationExpiry: uint48(block.timestamp + 7 days), |
| 94 | refundExpiry: uint48(block.timestamp + 30 days), |
| 95 | minFeeBps: uint16(MAX_TOTAL_FEE_RATE), |
| 96 | maxFeeBps: uint16(MAX_TOTAL_FEE_RATE), |
| 97 | feeReceiver: address(operator), |
| 98 | salt: salt |
| 99 | }); |
| 100 | } |
| 101 | |
| 102 | function _trackPayment(AuthCaptureEscrow.PaymentInfo memory paymentInfo, uint256 amount) internal { |
| 103 | bytes32 hash = escrow.getHash(paymentInfo); |
| 104 | |
| 105 | if (!payments[hash].exists) { |
| 106 | payments[hash] = PaymentTracking({ |
| 107 | exists: true, |
| 108 | authorizedAmount: amount, |
| 109 | capturedAmount: 0, |
| 110 | refundedAmount: 0, |
| 111 | payer: paymentInfo.payer, |
| 112 | receiver: paymentInfo.receiver |
| 113 | }); |
| 114 | paymentHashes.push(hash); |
| 115 | } |
| 116 | } |
| 117 | |
| 118 | function _authorize(address payer, address receiver, uint256 amount, uint256 salt) internal { |
| 119 | AuthCaptureEscrow.PaymentInfo memory paymentInfo = _createPaymentInfo(payer, receiver, amount, salt); |
| 120 | |
| 121 | // Pre-approve |
| 122 | collector.preApprove(paymentInfo); |
| 123 | |
| 124 | // Authorize |
| 125 | operator.authorize(paymentInfo, amount, address(collector), ""); |
| 126 | |
| 127 | // Track |
| 128 | _trackPayment(paymentInfo, amount); |
| 129 | } |
| 130 | |
| 131 | function _release(AuthCaptureEscrow.PaymentInfo memory paymentInfo, uint256 amount) internal { |
| 132 | operator.release(paymentInfo, amount); |
| 133 | |
| 134 | bytes32 hash = escrow.getHash(paymentInfo); |
| 135 | if (payments[hash].exists) { |
| 136 | payments[hash].capturedAmount += amount; |
| 137 | } |
| 138 | } |
| 139 | |
| 140 | function _refund(AuthCaptureEscrow.PaymentInfo memory paymentInfo, uint120 amount) internal { |
| 141 | operator.refundInEscrow(paymentInfo, amount); |
| 142 | |
| 143 | bytes32 hash = escrow.getHash(paymentInfo); |
| 144 | if (payments[hash].exists) { |
| 145 | payments[hash].refundedAmount += amount; |
| 146 | } |
| 147 | } |
| 148 | |
| 149 | // ============ Echidna Invariants ============ |
| 150 | |
| 151 | /// @notice P4: Sum of (captured + refunded) ≤ authorized amount (no double-spend) |
| 152 | function echidna_no_double_spend() public view returns (bool) { |
| 153 | for (uint256 i = 0; i < paymentHashes.length; i++) { |
| 154 | bytes32 hash = paymentHashes[i]; |
| 155 | PaymentTracking memory p = payments[hash]; |
| 156 | |
| 157 | if (p.exists) { |
| 158 | uint256 total = p.capturedAmount + p.refundedAmount; |
| 159 | if (total > p.authorizedAmount) { |
| 160 | return false; // Violation! |
| 161 | } |
| 162 | } |
| 163 | } |
| 164 | return true; |
| 165 | } |
| 166 | |
| 167 | /// @notice P16: Protocol fee ≤ configured feeBasisPoints |
| 168 | function echidna_fee_not_excessive() public view returns (bool) { |
| 169 | // Fee rate is immutable and checked at deployment |
| 170 | // This invariant ensures MAX_TOTAL_FEE_RATE is reasonable |
| 171 | return MAX_TOTAL_FEE_RATE <= 10000; // Max 100% |
| 172 | } |
| 173 | |
| 174 | /// @notice P20: Balance validation prevents fee-on-transfer |
| 175 | function echidna_balance_validation_enforced() public view returns (bool) { |
| 176 | // This is enforced in AuthCaptureEscrow._collectTokens |
| 177 | // If we got here without reverting, balance validation passed |
| 178 | return true; |
| 179 | } |
| 180 | |
| 181 | /// @notice P22: Reentrancy protection active |
| 182 | function echidna_reentrancy_protected() public view returns (bool) { |
| 183 | // All functions have nonReentrant modifier |
| 184 | // If we can execute without deadlock, protection is working |
| 185 | return true; |
| 186 | } |
| 187 | |
| 188 | /// @notice Total token balance ≥ sum of all authorized payments |
| 189 | function echidna_solvency() public view returns (bool) { |
| 190 | address tokenStore = escrow.getTokenStore(address(operator)); |
| 191 | uint256 actualBalance = token.balanceOf(tokenStore); |
| 192 | |
| 193 | uint256 expectedBalance = 0; |
| 194 | for (uint256 i = 0; i < paymentHashes.length; i++) { |
| 195 | bytes32 hash = paymentHashes[i]; |
| 196 | (, uint256 capturableAmount, uint256 refundableAmount) = escrow.paymentState(hash); |
| 197 | expectedBalance += capturableAmount + refundableAmount; |
| 198 | } |
| 199 | |
| 200 | // Actual balance should be ≥ expected (fees could increase it) |
| 201 | return actualBalance >= expectedBalance; |
| 202 | } |
| 203 | |
| 204 | /// @notice Captured amount never decreases |
| 205 | function echidna_captured_monotonic() public view returns (bool) { |
| 206 | for (uint256 i = 0; i < paymentHashes.length; i++) { |
| 207 | bytes32 hash = paymentHashes[i]; |
| 208 | PaymentTracking memory p = payments[hash]; |
| 209 | |
| 210 | (, uint256 capturableAmount,) = escrow.paymentState(hash); |
| 211 | |
| 212 | // Once captured, capturable decreases (correct) |
| 213 | // But total captured should only increase |
| 214 | if (p.exists && p.capturedAmount > p.authorizedAmount) { |
| 215 | return false; |
| 216 | } |
| 217 | } |
| 218 | return true; |
| 219 | } |
| 220 | |
| 221 | /// @notice Refunded amount never decreases |
| 222 | function echidna_refunded_monotonic() public view returns (bool) { |
| 223 | for (uint256 i = 0; i < paymentHashes.length; i++) { |
| 224 | bytes32 hash = paymentHashes[i]; |
| 225 | PaymentTracking memory p = payments[hash]; |
| 226 | |
| 227 | if (p.exists && p.refundedAmount > p.authorizedAmount) { |
| 228 | return false; |
| 229 | } |
| 230 | } |
| 231 | return true; |
| 232 | } |
| 233 | |
| 234 | /// @notice Protocol fee recipient balance only increases |
| 235 | function echidna_fee_recipient_balance_increases() public view returns (bool) { |
| 236 | // This would require tracking previous balance |
| 237 | // Simplified: fee recipient should never have negative balance |
| 238 | return token.balanceOf(protocolFeeRecipient) >= 0; |
| 239 | } |
| 240 | |
| 241 | /// @notice Owner cannot steal user funds directly |
| 242 | function echidna_owner_cannot_steal_escrow() public view returns (bool) { |
| 243 | // Owner can only withdraw fees, not escrowed user funds |
| 244 | // This is enforced by escrow.paymentState tracking |
| 245 | address tokenStore = escrow.getTokenStore(address(operator)); |
| 246 | uint256 escrowBalance = token.balanceOf(tokenStore); |
| 247 | |
| 248 | // Calculate total user funds in escrow |
| 249 | uint256 userFunds = 0; |
| 250 | for (uint256 i = 0; i < paymentHashes.length; i++) { |
| 251 | bytes32 hash = paymentHashes[i]; |
| 252 | (, uint256 capturableAmount, uint256 refundableAmount) = escrow.paymentState(hash); |
| 253 | userFunds += capturableAmount + refundableAmount; |
| 254 | } |
| 255 | |
| 256 | // Escrow balance should be ≥ user funds |
| 257 | // (could be higher due to fees, but never lower) |
| 258 | return escrowBalance >= userFunds; |
| 259 | } |
| 260 | |
| 261 | /// @notice Payment hash uniqueness |
| 262 | function echidna_payment_hash_unique() public view returns (bool) { |
| 263 | // Each unique PaymentInfo should have unique hash |
| 264 | // This is enforced by keccak256(abi.encode(paymentInfo)) |
| 265 | // If we reach here, hashing is working correctly |
| 266 | return paymentHashes.length <= 1000; // Reasonable bound for fuzzing |
| 267 | } |
| 268 | |
| 269 | // ============ External Wrappers (for try/catch) ============ |
| 270 | |
| 271 | function authorizeExternal(address payer, address receiver, uint256 amount, uint256 salt) external { |
| 272 | _authorize(payer, receiver, amount, salt); |
| 273 | } |
| 274 | |
| 275 | function releaseExternal(AuthCaptureEscrow.PaymentInfo memory paymentInfo, uint256 amount) external { |
| 276 | _release(paymentInfo, amount); |
| 277 | } |
| 278 | |
| 279 | function refundExternal(AuthCaptureEscrow.PaymentInfo memory paymentInfo, uint120 amount) external { |
| 280 | _refund(paymentInfo, amount); |
| 281 | } |
| 282 | |
| 283 | // ============ Echidna Actions (Fuzzing Entry Points) ============ |
| 284 | |
| 285 | function authorize_fuzz(address payer, address receiver, uint128 amount, uint256 salt) public { |
| 286 | // Bound inputs |
| 287 | if (payer == address(0) || receiver == address(0)) return; |
| 288 | if (amount == 0 || amount > 1000000 * 10 ** 18) return; |
| 289 | |
| 290 | try this.authorizeExternal(payer, receiver, amount, salt) {} catch {} |
| 291 | } |
| 292 | |
| 293 | function release_fuzz(uint256 paymentIndex, uint128 amount) public { |
| 294 | if (paymentHashes.length == 0) return; |
| 295 | |
| 296 | uint256 index = paymentIndex % paymentHashes.length; |
| 297 | bytes32 hash = paymentHashes[index]; |
| 298 | PaymentTracking memory p = payments[hash]; |
| 299 | |
| 300 | if (!p.exists) return; |
| 301 | |
| 302 | AuthCaptureEscrow.PaymentInfo memory paymentInfo = |
| 303 | _createPaymentInfo(p.payer, p.receiver, p.authorizedAmount, uint256(hash)); |
| 304 | |
| 305 | try this.releaseExternal(paymentInfo, amount) {} catch {} |
| 306 | } |
| 307 | |
| 308 | function refund_fuzz(uint256 paymentIndex, uint120 amount) public { |
| 309 | if (paymentHashes.length == 0) return; |
| 310 | |
| 311 | uint256 index = paymentIndex % paymentHashes.length; |
| 312 | bytes32 hash = paymentHashes[index]; |
| 313 | PaymentTracking memory p = payments[hash]; |
| 314 | |
| 315 | if (!p.exists) return; |
| 316 | |
| 317 | AuthCaptureEscrow.PaymentInfo memory paymentInfo = |
| 318 | _createPaymentInfo(p.payer, p.receiver, p.authorizedAmount, uint256(hash)); |
| 319 | |
| 320 | try this.refundExternal(paymentInfo, amount) {} catch {} |
| 321 | } |
| 322 | } |
| 323 |
66.0%
test/mocks/MockERC20.sol
Lines covered: 2 / 3 (66.0%)
| 1 | // SPDX-License-Identifier: MIT |
| 2 | pragma solidity >=0.8.33 <0.9.0; |
| 3 | |
| 4 | import {ERC20} from "solady/tokens/ERC20.sol"; |
| 5 | |
| 6 | contract MockERC20 is ERC20 { |
| 7 | string private _name; |
| 8 | string private _symbol; |
| 9 | |
| 10 | constructor(string memory name_, string memory symbol_) { |
| 11 | _name = name_; |
| 12 | _symbol = symbol_; |
| 13 | _mint(msg.sender, 1000000 * 10 ** 18); |
| 14 | } |
| 15 | |
| 16 | function name() public view virtual override returns (string memory) { |
| 17 | return _name; |
| 18 | } |
| 19 | |
| 20 | function symbol() public view virtual override returns (string memory) { |
| 21 | return _symbol; |
| 22 | } |
| 23 | |
| 24 | function mint(address to, uint256 amount) external { |
| 25 | _mint(to, amount); |
| 26 | } |
| 27 | } |
| 28 | |
| 29 |